|
|
@ -1,5 +1,9 @@ |
|
|
|
#!/usr/bin/env bash |
|
|
|
|
|
|
|
# GLOBALS |
|
|
|
|
|
|
|
declare UI_CROW UI_CCOL USER_INPUT |
|
|
|
|
|
|
|
# TERMINAL AND CURSOR INFO |
|
|
|
|
|
|
|
term_size() case $1 in |
|
|
@ -207,3 +211,34 @@ str_len() { |
|
|
|
|
|
|
|
in_string() [[ "$1" == *"$2"* ]] |
|
|
|
|
|
|
|
# WIDGETS |
|
|
|
|
|
|
|
input_bar() { |
|
|
|
local prompt position border line |
|
|
|
|
|
|
|
prompt="$1" |
|
|
|
position=bottom |
|
|
|
border=1 |
|
|
|
line=$(($(term_size l) - 3)) |
|
|
|
|
|
|
|
case $# in |
|
|
|
2) in_string 'top bottom' "$2" && position=$2 || border=$2;; |
|
|
|
3) position=$2; border=$3;; |
|
|
|
esac |
|
|
|
|
|
|
|
if ((border)); then |
|
|
|
[[ $position = top ]] && line=0 |
|
|
|
draw_frame $line 0 $(term_size c) 3 |
|
|
|
cmove_up |
|
|
|
cmove_right 2 |
|
|
|
else |
|
|
|
case $position in |
|
|
|
top) cmove_top 1;; |
|
|
|
bottom) cmove_bottom 1;; |
|
|
|
esac |
|
|
|
fi |
|
|
|
|
|
|
|
read -rep "$prompt " USER_INPUT |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|