aboutsummaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/bbask31
-rwxr-xr-xhelpers/bbcmd11
-rwxr-xr-xhelpers/bbconfirm9
-rwxr-xr-xhelpers/bbpause4
-rwxr-xr-xhelpers/bbpick39
-rwxr-xr-xhelpers/bbtargets25
-rwxr-xr-xhelpers/bbunscroll5
7 files changed, 0 insertions, 124 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
diff --git a/helpers/bbcmd b/helpers/bbcmd
deleted file mode 100755
index fdc4e78..0000000
--- a/helpers/bbcmd
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-if [ $# -eq 0 ]; then cat >> $BBCMD; exit; fi
-for arg; do
- shift
- if expr "$arg" : '^[^:]*:$' >/dev/null; then
- if [ $# -gt 0 ]; then printf "$arg%s\\0" "$@" >> $BBCMD
- else sed "s/\([^\\x00]\+\)/$arg\1/g" >> $BBCMD; fi
- exit
- fi
- printf "%s\\0" "$arg" >> $BBCMD
-done
diff --git a/helpers/bbconfirm b/helpers/bbconfirm
deleted file mode 100755
index cae1153..0000000
--- a/helpers/bbconfirm
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/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
diff --git a/helpers/bbpause b/helpers/bbpause
deleted file mode 100755
index 6604fbd..0000000
--- a/helpers/bbpause
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# Pause before continuing
-printf '\033[0;2m Press any key to continue...\033[0m' >/dev/tty
-bbask -1 >/dev/null
diff --git a/helpers/bbpick b/helpers/bbpick
deleted file mode 100755
index 3316484..0000000
--- a/helpers/bbpick
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# Pick from the provided input
-if [ -z "$PICKER" ]; then
- if command -v fzf >/dev/null; then
- PICKER=fzf
- elif command -v fzy >/dev/null; then
- PICKER=fzy
- elif command -v ask >/dev/null; then
- PICKER=ask
- elif command -v dmenu >/dev/null; then
- PICKER=dmenu
- elif command -v pick >/dev/null; then
- PICKER=pick
- fi
-fi
-
-case "$PICKER" in
- fzf)
- printf '\033[3A\033[?25h' >/dev/tty
- fzf --read0 --height=4 --prompt="$(printf "$1")"
- ;;
- fzy)
- printf '\033[3A\033[?25h' >/dev/tty
- tr '\0' '\n' | fzy --lines=3 --prompt="$(printf "\033[1m$1\033[0m")"
- ;;
- ask)
- ask --read0 --prompt="$(printf "$1\033[?25h")"
- ;;
- dmenu)
- tr '\0' '\n' | dmenu -i -l 10 -p "$(printf "$1")"
- ;;
- pick)
- printf '\033[?25h' >/dev/tty
- tr '\0' '\n' | pick
- ;;
- *)
- query="$(bbask "$1")" && grep -i -m1 "$(echo "$query" | sed 's;.;[^/&]*[&];g')"
- ;;
-esac
diff --git a/helpers/bbtargets b/helpers/bbtargets
deleted file mode 100755
index 1862ca0..0000000
--- a/helpers/bbtargets
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-# If the user is doing something ambiguous, like selecting a bunch of files,
-# moving the cursor off of those files, then doing an action, this will ask
-# what they mean to target, then output either 'cursor' or 'selected'.
-# Usage: targets "$BBCURSOR" "$@"
-cursor="$1"
-shift
-if [ $# -gt 0 ]; then
- for f in "$@"; do
- if [ "$f" = "$cursor" ]; then
- intended='Selected files'
- break
- fi
- done
-else
- intended='Cursor file'
-fi
-
-[ -z "$intended" ] && intended="$(printf '%s\0' 'Cursor file' 'Selected files' 'Both' | bbpick 'Which do you want to delete? ')"
-
-case "$intended" in
- Cursor*) echo cursor ;;
- Selected*) echo selected ;;
- Both) echo both ;;
-esac
diff --git a/helpers/bbunscroll b/helpers/bbunscroll
deleted file mode 100755
index 15102c4..0000000
--- a/helpers/bbunscroll
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-# Display text from the current line upward (instead of downward)
-input="$(cat)"
-printf "\\033[$(echo "$input" | wc -l)A\\033[J" >/dev/tty
-echo "$input"