From a76e3116d6803ecc4a829f96ac7b36bad1f90213 Mon Sep 17 00:00:00 2001 From: Pulak Kanti Bhowmick Date: Sun, 24 Nov 2024 11:45:26 +0600 Subject: [PATCH] add bool flag in custom command which was ignored before Signed-off-by: Pulak Kanti Bhowmick --- cmd/cmd_utils.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/cmd_utils.go b/cmd/cmd_utils.go index 2bdbdb8fb..bfcdc7c19 100644 --- a/cmd/cmd_utils.go +++ b/cmd/cmd_utils.go @@ -231,7 +231,7 @@ func executeCustomCommand( // Prepare template data for flags flags := cmd.Flags() - flagsData := map[string]string{} + flagsData := map[string]any{} for _, fl := range commandConfig.Flags { if fl.Type == "" || fl.Type == "string" { providedFlag, err := flags.GetString(fl.Name) @@ -239,6 +239,12 @@ func executeCustomCommand( u.LogErrorAndExit(cliConfig, err) } flagsData[fl.Name] = providedFlag + } else if fl.Type == "bool" { + boolFlag, err := flags.GetBool(fl.Name) + if err != nil { + u.LogErrorAndExit(cliConfig, err) + } + flagsData[fl.Name] = boolFlag } }