Skip to content

Commit

Permalink
deal with unreachable code warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
0robustus1 committed May 22, 2019
1 parent 8edc57e commit 64400ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fish_completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,16 @@ 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 {
return strings.Join(path, " ")
}
currentCmd = currentCmd.Parent()
}
return ""
}

func rangeCommands(cmd *Command, callback func(subCmd *Command)) {
Expand Down

0 comments on commit 64400ad

Please sign in to comment.