aboutsummaryrefslogtreecommitdiff
path: root/helpers/bbconfirm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-02-24 01:31:39 -0800
committerBruce Hill <bruce@bruce-hill.com>2020-02-24 01:31:39 -0800
commit865092c656af70bd5317513d8e0ed87fdc1c9acd (patch)
treec4311c89b75322b4bb9d7f3547ff0534b935d68f /helpers/bbconfirm
parenta8fd1743191bdb0a7453a2d90055e9dcc61a5ece (diff)
Major update: instead of defining all the helper functions as static
C-strings prefixed to commands (modified by the Makefile), the helper functions are now standalone scripts in the helpers/ dir, which gets added to "$PATH" when running bb.
Diffstat (limited to 'helpers/bbconfirm')
-rwxr-xr-xhelpers/bbconfirm9
1 files changed, 9 insertions, 0 deletions
diff --git a/helpers/bbconfirm b/helpers/bbconfirm
new file mode 100755
index 0000000..cae1153
--- /dev/null
+++ b/helpers/bbconfirm
@@ -0,0 +1,9 @@
+#!/bin/sh
+# Ask for user confirmation
+set -e
+if command -v ask >/dev/null; then
+ ask -n "$(printf "$1Is that okay?\033[?25h")"
+else
+ reply="$(bbask -1 "$(printf "$1\033[0;1mIs that okay? [y/N] ")")"
+ [ "$reply" != 'y' ]
+fi