From 30fb90bc5c38a40d31f5f122f0c28bb2d9d938f7 Mon Sep 17 00:00:00 2001 From: Yves Brissaud Date: Thu, 10 Oct 2024 02:39:07 +0200 Subject: [PATCH] fix: local options not override by ask Signed-off-by: Yves Brissaud --- internal/prompt/prompt.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/prompt/prompt.go b/internal/prompt/prompt.go index a868437..dabf4be 100644 --- a/internal/prompt/prompt.go +++ b/internal/prompt/prompt.go @@ -56,6 +56,7 @@ func Ask(action *runkit.Action, opts map[string]string) (map[string]string, erro err error form *huh.Form fields []huh.Field + asked []string ) for _, opt := range action.Options { @@ -79,6 +80,7 @@ func Ask(action *runkit.Action, opts map[string]string) (map[string]string, erro return huh.NewOption(str, str) })...)) } + asked = append(asked, opt.Name) } if len(fields) == 0 { @@ -90,8 +92,8 @@ func Ask(action *runkit.Action, opts map[string]string) (map[string]string, erro return nil, err } - for _, opt := range action.Options { - opts[opt.Name] = form.GetString(opt.Name) + for _, optName := range asked { + opts[optName] = form.GetString(optName) } return opts, nil