`confirm` function
jmervine opened this issue · 4 comments
jmervine commented
Add confirm
with usage like so:
# with success callback
on_succes() {
echo "Success"
}
confirm "Did you succeed?" "on_success"
# with success and failure callbacks
on_failure() {
echo "Failed"
}
confirm "Did you succeed?" "on_success" "on_failure"
# w/o callbacks
config "Did you succeed?" && echo "Why yes, yes I did!"
@jdorfman thoughts?
jmervine commented
In the same vein, I could add a dialog
as well, which displays a message and takes a response string an returns it. The idea being to emulate javascript's confirm
and dialog
here, all nicely encapsulated.
jmervine commented
confirm
should accept the following as an affirmative: y
, Y
, yes
, Yes
, YES
, ok
, OK
, Ok
, okay
, Okay
, OKAY
, continue
, Continue
, CONTINUE
, proceed
, Proceed
, PROCEED
, success
, Success
, SUCCESS
, successful
, Successful
, SUCCESSFUL
, good
, Good
, GOOD
...
I can also surface SHML_CONFIRM_SUCCESS
, which allow for user defined values.
Everything else would be negative/no.
@jdorfman can you think of anything else?
jdorfman commented
I would add k
, K
Love this: "Why yes, yes I did!"
jdorfman commented