deal with unreachable code warning.

This commit is contained in:
Tim Reddehase 2018-09-26 11:04:11 +02:00
parent 8edc57ef40
commit 64400adf08

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)) {