-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Support Force & Confirm #1783
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
Support Force & Confirm #1783
Conversation
|
Only added it for these commands: Are there any other critical ones we should add it for @tjprescott & @johanste? |
|
I believe the port does this for all delete operations, so I would lean toward that. |
tjprescott
left a comment
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.
A question but overall LGTM.
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.
I'm not entirely sure I understand this. There are three cases:
- True => default prompt enabled
- callable => you have access to the command namespace (?) and return true or false? Do we use this?
- string => enables the prompt with a custom message.
Does using #2 mean you essentially are using your own handler and throwing away the default one?
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.
Your understanding of 1 & 3 is correct.
For 2, you can specify your own confirmation prompt handler. You get the command namespace so you can use it if required. e.g. Print a custom prompt based on the name of one of the parameters.
And no we do not currently use 2 or 3 but there are use-cases where they'll be useful.
tjprescott
left a comment
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.
I'd recommend a second set of eyes, but LGTM.
- When registering a command, add `confirmation=True` to enable user confirmation. Also supports a string message or callable. - Add a —force flag for commands that support this feature. - Integrated with configuration system so it can be enabled/disabled by setting AZURE_CORE_DISABLE_CONFIRM_PROMPT Added for the following commands: az group delete az vm delete az network dns zone delete
394d676 to
4f44d99
Compare
Closes #1355
confirmation=Trueto enable user confirmation. Also supports a string message or callable.Added for the following commands:
az group delete
az vm delete
az network dns zone delete
EXAMPLES:
Only accepts appropriate values.
No TTY: