aboutsummaryrefslogtreecommitdiff
path: root/ask.1
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-06 17:46:59 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-06 17:46:59 -0700
commit88ed75a56bfebbaa9c5c023ebe2e03664106edbc (patch)
tree254866877a59b2578b8561107de2b0122d9f4fdd /ask.1
parent5f84d6988193a81d52e54696503d624a4e43780e (diff)
Added --yes and --no options, and renamed --initial to --query for
compatibility with fzf and fzy
Diffstat (limited to 'ask.1')
-rw-r--r--ask.140
1 files changed, 24 insertions, 16 deletions
diff --git a/ask.1 b/ask.1
index 3d262dd..9d7bff8 100644
--- a/ask.1
+++ b/ask.1
@@ -5,11 +5,10 @@
ask \- A tiny command line tool for getting user input
.SH SYNOPSIS
.B ask
-[\fI-hpqv\fR]
-[\fI--initial=initial\fR]
-[\fIprompt \fR
-[\fIinitial\fR
-[\fIoptions...\fR]]]
+[\fI-hPqvyn\fR]
+[\fI-q\fR |\fI--query=initial\fR]
+[[\fI-p\fR |\fI--prompt=\fR]\fIprompt \fR
+[\fIoptions...\fR]]
.SH DESCRIPTION
\fBask\fR is a tiny console application that displays a prompt, gets user input
(with line editing and fuzzy finding functionality), and prints the result to
@@ -20,7 +19,7 @@ standard output
When used with fuzzy finding, as soon as exactly one match is found, exit and
print it.
-.B \-p
+.B \-P
.B \--password
Use password mode, which does not print user input as it's being typed.
@@ -30,13 +29,27 @@ Print \fBask\fR's version and exit.
.B \-h
.B \--help
-Print ask's usage and exit.
+Print \fBask\fR's usage and exit.
-.B \--initial=initial
+.B \-q
+.B \--query=
If given, pre-populate the user input with this value.
-.B prompt
-If provided, display the given prompt in bold. (Default: "> ")
+.B \-p
+.B \--prompt=
+If provided, display the given prompt in bold. If the \fI-p\fR and
+\fI--prompt=\fR flags are not used, the first positional argument is used as
+the prompt, or \fB"> "\fR if there are no positional arguments.
+
+.B \-y
+.B \--yes
+Quickpick between "y" and "n" with "[Y/n]" appended to the prompt, exiting with
+success if "n" is not chosen.
+
+.B \-n
+.B \--no
+Quickpick between "y" and "n" with "[y/N]" appended to the prompt, exiting with
+failure if "y" is not chosen.
.B options...
If additional command line arguments are provided, or if any input is piped in,
@@ -56,13 +69,8 @@ Fuzzy find a file. (Equivalent of \fBrm "`ls | fzf --prompt='Delete file: '`"\fR
.TP
.B
-if test "`ask -q 'Do thing? [Y/n] ' '' Y N`" != N; then dothing; fi
+if ask -y 'Do thing? '; then dothing; fi
Ask user for confirmation (default: yes).
-.TP
-.B
-if test "`ask -q 'Do thing? [y/N] ' '' Y N`" = Y; then dothing; fi
-Ask user for confirmation (default: no).
-
.SH AUTHOR
Bruce Hill (bruce@bruce-hill.com)