feat: am : get_row + shellcheck fixes

This commit is contained in:
AngeD 2023-01-10 09:36:49 +01:00
parent 74aabdfb75
commit d35c6e2b98
4 changed files with 17 additions and 16 deletions

@ -1 +1 @@
Subproject commit 2df0fbdadd947cd2995566a0117b8802a9ba74f4
Subproject commit 7b98aadc6e85db4fc3af6c1ec22c4774d965506e

@ -1 +1 @@
Subproject commit 3e316204f8ec8450bbaace69d0bf8fe332633fec
Subproject commit 5fb315df12a3091f241b0326aed0ec70381adbd8

@ -1 +1 @@
Subproject commit 69dfd7758033b3e771dcd184c1b143d166a85481
Subproject commit 4181e8a2cc936bc7b7a89d674bf261023159ed35

27
bin/am
View File

@ -6,21 +6,22 @@ set -e
# usage
# support for /mnt
printf '\e[6n'
read -sdRr ROW
ROW="${ROW#*[}"
ROW="${ROW%;*}"
ROW="$((ROW + 1))"
function get_row() {
local pos row
printf '\e[6n' >&2
read -sdRr pos
pos="${pos#*[}"
row="${pos%;*}"
echo "$row"
}
ROW="$(($(get_row) + 1))"
function clear_output() {
local row
local len="$1"
printf '\e[6n'
read -sdRr row
row="${row#*[}"
row="${row%;*}"
for _ in $(seq 0 "$((row - ROW))"); do
row="$(get_row)"
for _ in $(seq "$ROW" "$row"); do
printf '\e[1A\e[K'
done
}
@ -28,7 +29,7 @@ function clear_output() {
function umount_all() {
local disks
disks=($(mount | grep udisks2 | cut -f1 -d' '))
readarray -t disks <<< "$(mount | grep udisks2 | cut -f1 -d' ')"
umount "${disks[@]}"
echo "unmounted ${disks[*]}"