-
Notifications
You must be signed in to change notification settings - Fork 881
feat: Add confirm prompts to some cli actions #1591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Emyrk
commented
May 19, 2022
- Workspace start/stop
- Add optional -y skip. Standardize -y flag across commands
- Workspace start/stop - Add optional -y skip. Standardize -y flag across commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the tests.
I cannot figure out why Mac is failing 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change!
Just an idea: Would it be nice to have --yes
as a global always-enabled flag? My thought here is that users who don't care about prompts may want to always append the -y
flag, even if that's sensible or not.
// "yes" makes no sense. | ||
if opts.IsConfirm && cmd.Flags().Lookup("yes") != nil { | ||
if skip, _ := cmd.Flags().GetBool("yes"); skip { | ||
return "yes", nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we print to the terminal here e.g. Confirm create? (yes/no) yes
, or Skipping: Confirm create? (yes/no)
just to make it clear that the --yes
flag had an effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mafredri I was unsure. Do other applications do this? apt-get
does not have any indication for example.
For scripting purposes, I would imagine we want to reduce output to near 0 if we can.
I am not opposed to making it a global flag, would like to hear what others think. It's an easy change. |
* feat: Add confirm prompts to some cli actions - Add optional -y skip. Standardize -y flag across commands