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

Commit

Permalink
Fix plugin command delegation
Browse files Browse the repository at this point in the history
Signed-off-by: Ulysses Souza <[email protected]>
  • Loading branch information
ulyssessouza committed Nov 3, 2021
1 parent 90389a6 commit 5aa293c
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 5aa293c

Please sign in to comment.