Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 461f022

Browse files
author
Ulysses Souza
authored
Merge pull request #2095 from ulyssessouza/fix-version-plugin-delegation
Fix plugin command delegation for version
2 parents 90389a6 + 5aa293c commit 461f022

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cli/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,16 @@ func isContextAgnosticCommand(cmd *cobra.Command) bool {
101101
if cmd == nil {
102102
return false
103103
}
104-
if _, ok := contextAgnosticCommands[cmd.Name()]; ok {
104+
if _, ok := contextAgnosticCommands[cmd.Name()]; ok && isFirstLevelCommand(cmd) {
105105
return true
106106
}
107107
return isContextAgnosticCommand(cmd.Parent())
108108
}
109109

110+
func isFirstLevelCommand(cmd *cobra.Command) bool {
111+
return !cmd.HasParent() || !cmd.Parent().HasParent()
112+
}
113+
110114
func main() {
111115
var opts cliopts.GlobalOpts
112116
root := &cobra.Command{

0 commit comments

Comments
 (0)