-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
feat(prompts): add ability for tasks to prompt user pre execution #1163
Conversation
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.
Hi @MaxCheetham, thanks for your contribution!
A few things needs to be adjusted before this is ready to be merged.
- I noticed a bug where the prompt is not really asked if the task is called indirectly.
version: '3'
tasks:
default:
cmds:
- task: show-prompt
show-prompt:
prompt: Are you sure?
cmds:
- echo Hi
Calling task show-prompt
asks confirmation, but task default
not. I believe it should be shown on both cases.
- A
--yes
(alias-y
) might be needed here, otherwise it would be impossible to ask run these tasks on a CI, for example. This flag would bypass the confirmation and run anyway.
A section on the Usage page in the documentation could be interesting as well. Another contributor wrote this for an implementation that end up not being merged. You could use that as inspiration. |
Hey @andreynering, thanks for catching that bug, and also the request for the enchancements.
|
Thanks @MaxCheetham! I did a few improvements on 44aaec8. The most important one being a fix that forces the task to fail on a non-terminal environment (imagine CI). Without this, the task would hang forever waiting for someone to type |
fixes #100
Adding a
Prompt
filed to allow users to set a message to be shown before task excecution.Also added an early exit code (205) for when this happens