commandCatalogPath reconstructs the catalog path [service, resource..., method] from a command's ancestry, excluding the root command. It is the inverse of the service command tree's construction, so any depth (flat or nested) round-trips through apicatalog.Resolve.
(cmd *cobra.Command)
| 118 | // the service command tree's construction, so any depth (flat or nested) |
| 119 | // round-trips through apicatalog.Resolve. |
| 120 | func commandCatalogPath(cmd *cobra.Command) []string { |
| 121 | var path []string |
| 122 | for c := cmd; c != nil && c.Parent() != nil; c = c.Parent() { |
| 123 | path = append([]string{c.Name()}, path...) |
| 124 | } |
| 125 | return path |
| 126 | } |
| 127 | |
| 128 | // shortcutSupportsIdentity reports whether a shortcut supports the requested |
| 129 | // identity, applying the default user-only behavior when AuthTypes is empty. |