about summary refs log tree commit diff stats
path: root/bin/prompt
diff options
context:
space:
mode:
Diffstat (limited to 'bin/prompt')
-rwxr-xr-xbin/prompt10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/prompt b/bin/prompt
new file mode 100755
index 0000000..ac1a319
--- /dev/null
+++ b/bin/prompt
@@ -0,0 +1,10 @@
+#!/bin/sh
+# calls dmenu with $1 as the prompt and "no" and "yes" as the options.
+# if "yes" is chosen, call $2.
+if [ $# -eq 1 ]; then
+	case "$1" in
+		[!-]*|-*[!h]*) return 1 ;;
+		*h*) printf 'usage: %s [-h]|prompt cmd\n' "$(basename $0)">/dev/stderr&&return 1 ;;
+	esac
+fi
+[ "$(printf "no\\nyes"|dmenu -p "$1")" = "yes" ] && $2