feat: am : get_row + shellcheck fixes
This commit is contained in:
parent
74aabdfb75
commit
d35c6e2b98
@ -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
27
bin/am
@ -6,21 +6,22 @@ set -e
|
|||||||
# usage
|
# usage
|
||||||
# support for /mnt
|
# support for /mnt
|
||||||
|
|
||||||
printf '\e[6n'
|
function get_row() {
|
||||||
read -sdRr ROW
|
local pos row
|
||||||
ROW="${ROW#*[}"
|
|
||||||
ROW="${ROW%;*}"
|
printf '\e[6n' >&2
|
||||||
ROW="$((ROW + 1))"
|
read -sdRr pos
|
||||||
|
pos="${pos#*[}"
|
||||||
|
row="${pos%;*}"
|
||||||
|
echo "$row"
|
||||||
|
}
|
||||||
|
|
||||||
|
ROW="$(($(get_row) + 1))"
|
||||||
function clear_output() {
|
function clear_output() {
|
||||||
local row
|
local row
|
||||||
local len="$1"
|
|
||||||
|
|
||||||
printf '\e[6n'
|
row="$(get_row)"
|
||||||
read -sdRr row
|
for _ in $(seq "$ROW" "$row"); do
|
||||||
row="${row#*[}"
|
|
||||||
row="${row%;*}"
|
|
||||||
|
|
||||||
for _ in $(seq 0 "$((row - ROW))"); do
|
|
||||||
printf '\e[1A\e[K'
|
printf '\e[1A\e[K'
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -28,7 +29,7 @@ function clear_output() {
|
|||||||
function umount_all() {
|
function umount_all() {
|
||||||
local disks
|
local disks
|
||||||
|
|
||||||
disks=($(mount | grep udisks2 | cut -f1 -d' '))
|
readarray -t disks <<< "$(mount | grep udisks2 | cut -f1 -d' ')"
|
||||||
|
|
||||||
umount "${disks[@]}"
|
umount "${disks[@]}"
|
||||||
echo "unmounted ${disks[*]}"
|
echo "unmounted ${disks[*]}"
|
||||||
|
Loading…
Reference in New Issue
Block a user