commandName returns the path components for a given command, in reverse alphabetical order for consistent usage metrics. The root Compose command and anything before (i.e. "docker") are not included. For example: - docker compose alpha watch -> [watch, alpha] - docker-compose up -> [up]
(cmd *cobra.Command)
| 128 | // - docker compose alpha watch -> [watch, alpha] |
| 129 | // - docker-compose up -> [up] |
| 130 | func commandName(cmd *cobra.Command) []string { |
| 131 | var name []string |
| 132 | for c := cmd; c != nil; c = c.Parent() { |
| 133 | if c.Name() == commands.PluginName { |
| 134 | break |
| 135 | } |
| 136 | name = append(name, c.Name()) |
| 137 | } |
| 138 | sort.Sort(sort.Reverse(sort.StringSlice(name))) |
| 139 | return name |
| 140 | } |
| 141 | |
| 142 | func getFlags(fs *flag.FlagSet) []string { |
| 143 | var result []string |