MCPcopy
hub / github.com/larksuite/cli / availableSubcommandNames

Function availableSubcommandNames

cmd/root.go:531–549  ·  view source on GitHub ↗

availableSubcommandNames returns the invokable subcommand names of cmd, split into current commands and backward-compatibility aliases (those tagged into the deprecated cobra group via cmdutil.DeprecatedGroupID). Both slices are sorted; hidden commands plus help/completion are omitted.

(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

529// the deprecated cobra group via cmdutil.DeprecatedGroupID). Both slices are
530// sorted; hidden commands plus help/completion are omitted.
531func availableSubcommandNames(cmd *cobra.Command) (available, deprecated []string) {
532 for _, c := range cmd.Commands() {
533 if c.Hidden || !c.IsAvailableCommand() {
534 continue
535 }
536 name := c.Name()
537 if name == "help" || name == "completion" {
538 continue
539 }
540 if cmdutil.IsDeprecatedCommand(c) {
541 deprecated = append(deprecated, name)
542 } else {
543 available = append(available, name)
544 }
545 }
546 sort.Strings(available)
547 sort.Strings(deprecated)
548 return available, deprecated
549}
550
551// Root command help groups, so an agent sees content domains, agent tooling, and
552// CLI management as distinct blocks instead of one flat alphabetical dump.

Calls 2

IsDeprecatedCommandFunction · 0.92
NameMethod · 0.65