about summary refs log tree commit diff stats
path: root/bin/prompt
diff options
context:
space:
mode:
authorEnsa <psychoticfervor@tuta.io>2019-12-20 00:14:09 -0800
committerEnsa <psychoticfervor@tuta.io>2019-12-20 00:14:09 -0800
commit4684d80b6271dd775cd23dabf2b91d6ce56fa33a (patch)
treeddb6c6219e213132b8500e016b1ce238aa71029d /bin/prompt
parentf733ca7c8041866df27752c8e0c2610e0ecef6a7 (diff)
downloadcfg-4684d80b6271dd775cd23dabf2b91d6ce56fa33a.tar.gz
first significant commit
see README.md for information
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