MCPcopy Create free account
hub / github.com/algolia/cli / AddBasicUsage

Method AddBasicUsage

pkg/cmdutil/usage.go:30–54  ·  view source on GitHub ↗
(IOStreams *iostreams.IOStreams, command *cobra.Command)

Source from the content-addressed store, hash-verified

28}
29
30func (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
56func (u *UsageEntries) AddFlags(
57 IOStreams *iostreams.IOStreams,

Callers 4

UsageFuncFunction · 0.95
rootHelpFuncFunction · 0.95

Calls 4

AddEntryMethod · 0.95
rpadFunction · 0.85
ColorSchemeMethod · 0.80
BoldMethod · 0.80

Tested by

no test coverage detected