Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2095 from ulyssessouza/fix-version-plugin-delegation
Browse files Browse the repository at this point in the history
Fix plugin command delegation for version
  • Loading branch information
ulyssessouza authored Nov 3, 2021
2 parents 90389a6 + 5aa293c commit 461f022
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,16 @@ func isContextAgnosticCommand(cmd *cobra.Command) bool {
if cmd == nil {
return false
}
if _, ok := contextAgnosticCommands[cmd.Name()]; ok {
if _, ok := contextAgnosticCommands[cmd.Name()]; ok && isFirstLevelCommand(cmd) {
return true
}
return isContextAgnosticCommand(cmd.Parent())
}

func isFirstLevelCommand(cmd *cobra.Command) bool {
return !cmd.HasParent() || !cmd.Parent().HasParent()
}

func main() {
var opts cliopts.GlobalOpts
root := &cobra.Command{
Expand Down

0 comments on commit 461f022

Please sign in to comment.