aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorepoch <epoch@thebackupbox.net>2022-08-19 01:24:02 -0500
committerepoch <epoch@thebackupbox.net>2022-08-19 01:24:02 -0500
commitb5b1d77dfd83853b5f4a945e02fbc9269114fe05 (patch)
tree6de7b578ae6088b8647fd788fb69e82649bb7a90
parente5a205847adc8107cf4ffc2584128f101d061e8f (diff)
downloaduritools-b5b1d77dfd83853b5f4a945e02fbc9269114fe05.tar.gz
uritools-b5b1d77dfd83853b5f4a945e02fbc9269114fe05.zip
limit a prompt to 64 characters
-rwxr-xr-xchoose9
1 files changed, 8 insertions, 1 deletions
diff --git a/choose b/choose
index 763c71c..aa191e7 100755
--- a/choose
+++ b/choose
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
### this script is meant to take a \n delimited list of things
### then give the user a way of selecting on of them.
### it should output the selection on a line by itself.
@@ -11,6 +11,13 @@ if [ "$1" ];then
else
prompt="< $0 >"
fi
+
+if [ "${prompt}" != "${prompt:0:64}" ];then
+ prompt="${prompt:0:64}..."
+else
+ prompt="${prompt}"
+fi
+
if [ $DISPLAY ];then
#usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
# [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]