From 88fd9c416be0f5fe1e5fd48ba7c27d4d1e25261c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 24 Feb 2020 03:39:44 -0800 Subject: Moved bbstartup into a script, renamed helper/ -> scripts/, and added bbshutdown script. Also tweaked some of the precedence. --- scripts/bbtargets | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/bbtargets (limited to 'scripts/bbtargets') diff --git a/scripts/bbtargets b/scripts/bbtargets new file mode 100755 index 0000000..1862ca0 --- /dev/null +++ b/scripts/bbtargets @@ -0,0 +1,25 @@ +#!/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 -- cgit v1.2.3