mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
call Root PersistentPreRun on Completion Command
This commit is contained in:
parent
2d1eeaf169
commit
ef1328f8cf
1 changed files with 3 additions and 0 deletions
|
@ -689,6 +689,9 @@ See each sub-command's help for details on how to use the generated script.
|
||||||
flag.Annotations[BashCompOneRequiredFlag] = []string{"false"}
|
flag.Annotations[BashCompOneRequiredFlag] = []string{"false"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// Adding PersistentPreRun on sub-commands prevents root's PersistentPreRun from being called.
|
||||||
|
// So it is intentionally called here.
|
||||||
|
cmd.Root().PersistentPreRun(cmd.Root(), args)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
c.AddCommand(completionCmd)
|
c.AddCommand(completionCmd)
|
||||||
|
|
Loading…
Reference in a new issue