Skip to content

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

Merged
merged 18 commits into from
May 20, 2022
Merged

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented May 19, 2022

  • Workspace start/stop
  • Add optional -y skip. Standardize -y flag across commands

Emyrk added 2 commits May 19, 2022 10:28
- Workspace start/stop
- Add optional -y skip. Standardize -y flag across commands
@Emyrk Emyrk requested a review from AbhineetJain May 19, 2022 19:56
Copy link
Contributor

@AbhineetJain AbhineetJain left a 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.

@Emyrk
Copy link
Member Author

Emyrk commented May 19, 2022

I cannot figure out why Mac is failing 🤔

Copy link
Member

@mafredri mafredri left a 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
Copy link
Member

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?

Copy link
Member Author

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.

@Emyrk
Copy link
Member Author

Emyrk commented May 20, 2022

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.

I am not opposed to making it a global flag, would like to hear what others think. It's an easy change.

@Emyrk Emyrk enabled auto-merge (squash) May 20, 2022 15:52
@Emyrk Emyrk merged commit ad946c3 into main May 20, 2022
@Emyrk Emyrk deleted the stevenmasley/skip_prompt branch May 20, 2022 15:59
kylecarbs pushed a commit that referenced this pull request Jun 10, 2022
* feat: Add confirm prompts to some cli actions
- Add optional -y skip. Standardize -y flag across commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants