(IOStreams *iostreams.IOStreams, command *cobra.Command)
| 28 | } |
| 29 | |
| 30 | func (u *UsageEntries) AddBasicUsage(IOStreams *iostreams.IOStreams, command *cobra.Command) { |
| 31 | cs := IOStreams.ColorScheme() |
| 32 | u.AddEntry(UsageEntry{cs.Bold("Usage:"), command.UseLine()}) |
| 33 | subcommands := command.Commands() |
| 34 | |
| 35 | if len(subcommands) > 0 { |
| 36 | namePadding := 12 |
| 37 | commands := []string{} |
| 38 | for _, c := range subcommands { |
| 39 | if c.Short == "" { |
| 40 | continue |
| 41 | } |
| 42 | if c.Hidden { |
| 43 | continue |
| 44 | } |
| 45 | commands = append(commands, rpad(c.Name()+":", namePadding)+c.Short) |
| 46 | } |
| 47 | |
| 48 | u.AddEntry(UsageEntry{ |
| 49 | cs.Bold("Available commands:"), |
| 50 | strings.Join(commands, "\n"), |
| 51 | }, |
| 52 | ) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func (u *UsageEntries) AddFlags( |
| 57 | IOStreams *iostreams.IOStreams, |
no test coverage detected