deal with unreachable code warning.

This commit is contained in:
Tim Reddehase 2018-09-26 11:04:11 +02:00 committed by David Gillies
parent 5f46ad3b9b
commit a407b6c143
No known key found for this signature in database
GPG key ID: BD350530941BDC96

View file

@ -119,6 +119,9 @@ func flagRequiresArgumentCompletion(flag *pflag.Flag) string {
func subCommandPath(rootCmd *Command, cmd *Command) string {
path := []string{}
currentCmd := cmd
if rootCmd == cmd {
return ""
}
for {
path = append([]string{currentCmd.Name()}, path...)
if currentCmd.Parent() == rootCmd {
@ -126,7 +129,6 @@ func subCommandPath(rootCmd *Command, cmd *Command) string {
}
currentCmd = currentCmd.Parent()
}
return ""
}
func rangeCommands(cmd *Command, callback func(subCmd *Command)) {