Deprecated subcommands

They should still work, but shouldn't show up in help or usage output
This commit is contained in:
Eric Paris
2015-04-07 17:38:22 -04:00
parent 69e5f196b5
commit c3e48f996d
6 changed files with 48 additions and 5 deletions

View File

@ -199,6 +199,9 @@ func postscript(out *bytes.Buffer, name string) {
func writeCommands(cmd *Command, out *bytes.Buffer) {
fmt.Fprintf(out, " commands=()\n")
for _, c := range cmd.Commands() {
if len(c.Deprecated) > 0 {
continue
}
fmt.Fprintf(out, " commands+=(%q)\n", c.Name())
}
fmt.Fprintf(out, "\n")
@ -291,6 +294,9 @@ func writeRequiredNoun(cmd *Command, out *bytes.Buffer) {
func gen(cmd *Command, out *bytes.Buffer) {
for _, c := range cmd.Commands() {
if len(c.Deprecated) > 0 {
continue
}
gen(c, out)
}
commandName := cmd.CommandPath()