aboutsummaryrefslogtreecommitdiff
path: root/helpers/bbask
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-02-24 03:39:44 -0800
committerBruce Hill <bruce@bruce-hill.com>2020-02-24 03:39:44 -0800
commit88fd9c416be0f5fe1e5fd48ba7c27d4d1e25261c (patch)
treecfe311fb81c1d12e46b08de175a6296f0aed7a0d /helpers/bbask
parent304cbddf730b86dec2b3d7c414fd0b9a38c69d76 (diff)
Moved bbstartup into a script, renamed helper/ -> scripts/, and added
bbshutdown script. Also tweaked some of the precedence.
Diffstat (limited to 'helpers/bbask')
-rwxr-xr-xhelpers/bbask31
1 files changed, 0 insertions, 31 deletions
diff --git a/helpers/bbask b/helpers/bbask
deleted file mode 100755
index ad446ec..0000000
--- a/helpers/bbask
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-# A simple user-input asker. Result is output to stdout.
-# Usage: ask [-1] [prompt [initial query]]
-if [ "$1" = '-1' ]; then
- # Get one character of input
- tput civis >/dev/tty;
- printf '\033[1m%s\033[0m' "$2" >/dev/tty;
- stty -icanon -echo >/dev/tty 2>/dev/tty;
- if [ "$(uname)" = "Darwin" ]; then
- read -n 1 REPLY </dev/tty >/dev/tty;
- echo $REPLY
- else
- dd bs=1 count=1 2>/dev/null </dev/tty
- fi
- stty icanon echo >/dev/tty 2>/dev/tty
- tput cvvis >/dev/tty
-else
- # Get a line of input
- if command -v ask >/dev/null; then
- ask --history=bb.hist --prompt="$(printf '%s\033[?25h' "$1")" --query="$2"
- else
- printf "\033[1m%s\033[0m" "$1" >/dev/tty
- tput cvvis >/dev/tty
- if [ "$(uname)" = "Darwin" ]; then
- read -e REPLY </dev/tty >/dev/tty
- else
- read REPLY </dev/tty >/dev/tty
- fi
- echo $REPLY
- fi
-fi