mirror of
https://github.com/mjsarfatti/beddu.git
synced 2025-06-26 17:08:01 +02:00
Ask -> Request, while Seek makes the answer optional
This commit is contained in:
parent
5ff6a50d32
commit
ce6bfcd04c
6 changed files with 93 additions and 33 deletions
12
README.md
12
README.md
|
@ -78,10 +78,15 @@ pen "This is $(pen yellow "yellow"), and this is $(pen bold "bold")"
|
|||
### Interactive Functions
|
||||
|
||||
```bash
|
||||
# Ask for input
|
||||
ask name "What's your name?"
|
||||
# Kindly ask for input (empty answer is accepted)
|
||||
seek name "What's your name?"
|
||||
pen "Hello, $name!"
|
||||
|
||||
# Firmly ask for input (empty answer NOT accepted)
|
||||
request name "No really, what's your name?"
|
||||
pen "There you go, $name!"
|
||||
|
||||
|
||||
# Yes/no confirmation (defaults to "yes")
|
||||
if confirm "Continue?"; then
|
||||
pen green "Continuing..."
|
||||
|
@ -131,7 +136,8 @@ check "Task completed!" # We can directly `check`, `warn`, or `throw` after a `s
|
|||
|
||||
### User Interaction
|
||||
|
||||
- `ask [retval] PROMPT` - Get text input from user, saves the answer in `$retval`
|
||||
- `seek [retval] PROMPT` - Get (optional) text input from user, saves the answer in `$retval`
|
||||
- `request [retval] PROMPT` - Like above, but doesn't accept an empty response, saves the answer in `$retval`
|
||||
- `confirm [OPTIONS] PROMPT` - Get yes/no input
|
||||
- `--default-yes` - Set default answer to "yes" (default behavior)
|
||||
- `--default-no` - Set default answer to "no"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue