When creating new commands via `cobra add`, it is not possible to add
commands with the same name to different parents. They will just
overwrite each other.
With this patch, the command's object identifier is templated
`parentCommandCmd`, the `Use` field `command` and the file name
`parent_command.go`.
Fixes#1059Fixes#1131
Signed-off-by: Carlos Marx <me@carlosmarx.com>
* fix: ensure that testproject is removed even after a failure
* fix: defer licenseFile
* style: simply defer os.RemoveAll
* cobra/cmd: add getProject test func
* update Example in README.md (#769)
* specify the color as the required arg (#777)
* command: fix typo in docstring of InheritedFlags (#779)
* add istio to the list of projects built with Cobra (#786)
* remove redundant 'else' (#806)
* add mattermost-server as a project built with Cobra (#824)
* update README.md (#826)
Fix the comment: consistent with others
* add uber/prototool as a project built with Cobra (#831)
* fix(ci): use go vet, update to Go 1.12, update shellcheck to v0.4.6 (#832)
* add go.mod and go.sum (#833)
* chore(travis): move 'diff' job to separate stage in Travis (#839)
* chore(travis): use language configuration list instead of explicit entries in matrix.include (#839)
* chore(travis): update shellcheck-docker to v0.6.0 (#839)
* update(README.md): separate projects by commas, instead of using a list
* chore: update viper to v1.3.2 and go-md2man to v1.0.10
* fix: convert CRLF to LF when comparing files
* use kyoh86/richgo to provide colored test outputs
Update Cobra generator to make rootCmd private rather than
exporting it. Also update examples in README to use the exported
Execute() command rather than referencing unexported rootCmd.
Fixes#556