From 39a6bbba47e707c64f67fee5620301716cfb08d0 Mon Sep 17 00:00:00 2001 From: Francis Nickels <fnickels@riotgames.com> Date: Mon, 3 Mar 2025 14:31:20 -0800 Subject: [PATCH] Add HasCustomFlagCompletion method to Command struct for flag completion validation --- command.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/command.go b/command.go index ec43d7c5..470c7517 100644 --- a/command.go +++ b/command.go @@ -1607,6 +1607,17 @@ func (c *Command) HasSubCommands() bool { 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 // (this includes all non deprecated/hidden commands). func (c *Command) IsAvailableCommand() bool {