mirror of
https://github.com/spf13/cobra
synced 2025-04-07 07:19:16 +00:00
Add HasCustomFlagCompletion method to Command struct for flag completion validation
This commit is contained in:
parent
3736e5e7b8
commit
39a6bbba47
1 changed files with 11 additions and 0 deletions
11
command.go
11
command.go
|
@ -1607,6 +1607,17 @@ func (c *Command) HasSubCommands() bool {
|
||||||
return len(c.commands) > 0
|
return len(c.commands) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsAvailableCommand determines if a command is available as a non-help command
|
||||||
|
// (this includes all non deprecated/hidden commands).
|
||||||
|
func (c *Command) HasCustomFlagCompletion() bool {
|
||||||
|
|
||||||
|
if c.ValidArgsFunction == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.AllowCustomFlagCompletions
|
||||||
|
}
|
||||||
|
|
||||||
// IsAvailableCommand determines if a command is available as a non-help command
|
// IsAvailableCommand determines if a command is available as a non-help command
|
||||||
// (this includes all non deprecated/hidden commands).
|
// (this includes all non deprecated/hidden commands).
|
||||||
func (c *Command) IsAvailableCommand() bool {
|
func (c *Command) IsAvailableCommand() bool {
|
||||||
|
|
Loading…
Reference in a new issue