From 57e4924e4b11239fef3d9d16444609f04145e176 Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Tue, 26 Jan 2021 20:29:45 -0300 Subject: [PATCH] Style prompts --- internal/cli/rules.go | 2 +- internal/prompt/prompt.go | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/cli/rules.go b/internal/cli/rules.go index 8f0b1a877..5f5f9bffa 100644 --- a/internal/cli/rules.go +++ b/internal/cli/rules.go @@ -243,7 +243,7 @@ func deleteRulesCmd(cli *cli) *cobra.Command { }, } - cmd.Flags().StringVar(&flags.id, "id", "", "ID of the rule to delete (required)") + cmd.Flags().StringVarP(&flags.id, "id", "i", "", "ID of the rule to delete (required)") cmd.Flags().BoolVarP(&flags.force, "force", "f", false, "Do not ask for confirmation.") mustRequireFlags(cmd, "id") diff --git a/internal/prompt/prompt.go b/internal/prompt/prompt.go index edcb7aae6..782d2b0b6 100644 --- a/internal/prompt/prompt.go +++ b/internal/prompt/prompt.go @@ -8,8 +8,16 @@ import ( var stdErrWriter = survey.WithStdio(os.Stdin, os.Stderr, os.Stderr) +var icons = survey.WithIcons(func(icons *survey.IconSet) { + icons.Question.Text = "" +}) + func Ask(inputs []*survey.Question, response interface{}) error { - return survey.Ask(inputs, response, stdErrWriter) + return survey.Ask(inputs, response, stdErrWriter, icons) +} + +func AskOne(prompt survey.Prompt, response interface{}) error { + return survey.AskOne(prompt, response, stdErrWriter, icons) } func TextInput(name string, message string, help string, value string, required bool) *survey.Question { @@ -46,7 +54,7 @@ func Confirm(message string) bool { Message: message, } - if err := survey.AskOne(prompt, &result, stdErrWriter); err != nil { + if err := AskOne(prompt, &result); err != nil { return false }