(w io.Writer, cmd *cobra.Command)
| 36 | } |
| 37 | |
| 38 | func printOptions(w io.Writer, cmd *cobra.Command) error { |
| 39 | flags := cmd.NonInheritedFlags() |
| 40 | flags.SetOutput(w) |
| 41 | if flags.HasAvailableFlags() { |
| 42 | fmt.Fprint(w, "### Options\n\n") |
| 43 | if err := printFlagsHTML(w, flags); err != nil { |
| 44 | return err |
| 45 | } |
| 46 | fmt.Fprint(w, "\n\n") |
| 47 | } |
| 48 | |
| 49 | parentFlags := cmd.InheritedFlags() |
| 50 | parentFlags.SetOutput(w) |
| 51 | if hasNonHelpFlags(parentFlags) { |
| 52 | fmt.Fprint(w, "### Options inherited from parent commands\n\n") |
| 53 | if err := printFlagsHTML(w, parentFlags); err != nil { |
| 54 | return err |
| 55 | } |
| 56 | fmt.Fprint(w, "\n\n") |
| 57 | } |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | func hasNonHelpFlags(fs *pflag.FlagSet) (found bool) { |
| 62 | fs.VisitAll(func(f *pflag.Flag) { |
no test coverage detected