diff --git a/.local/bin/scripts/ds b/.local/bin/scripts/ds index 9e91527..49a6b04 100755 --- a/.local/bin/scripts/ds +++ b/.local/bin/scripts/ds @@ -6,7 +6,7 @@ if test "$1" = "f" else IFS="\n" cols=$(tput cols) - lsblk --output name,size,fsavail,fsuse%,mountpoints,label,fstype$(test $cols -gt 110 && echo ',uuid') --width $cols | + lsblk --output name,size,fsavail,fsuse%,mountpoints,label,fstype$(test $cols -gt 120 && echo ',uuid') --width $cols | while read line do p=$(echo "$line" | sed 's|.* \([[:digit:]]\+\)%.*|\1|;t;c0') printf "$(expr "$line" : " " >/dev/null || echo "\033[$(test -z "$first" && echo "4" || expr "5;31" \& "$p" \> 98 \| "31" \& "$p" \> 97 \| "33" \& "$p" \> 94 \| "35" \& "$p" \> 90)m")%s\n" "$line" diff --git a/.local/bin/scripts/moul b/.local/bin/scripts/moul index d89a727..ac0cd69 100755 --- a/.local/bin/scripts/moul +++ b/.local/bin/scripts/moul @@ -1,5 +1,6 @@ #!/bin/sh -e # Mount a partition by label or device identifier automatically +# TODO Autocomplete: lsblk --output label --noheadings arg=$1 test "$arg" = "--help" && echo "$0 [mountpoint] [options...]" && exit 0 if test "$arg" = "-u" diff --git a/.local/bin/scripts/plantclip b/.local/bin/scripts/plantclip new file mode 100755 index 0000000..cb5f885 --- /dev/null +++ b/.local/bin/scripts/plantclip @@ -0,0 +1,7 @@ +#!/bin/sh +# plantuml from xclip selection clipboard +file="/tmp/plantuml-xclip-$(date +%s).plantuml" +echo "@startuml" >$file +xclip -o >>$file +echo -e "\n@enduml" >>$file +plantuml $file diff --git a/.local/bin/scripts/rd b/.local/bin/scripts/rd index ee585ed..0e1cbb8 100755 --- a/.local/bin/scripts/rd +++ b/.local/bin/scripts/rd @@ -12,7 +12,7 @@ do test "$answer" = "y" && $elevate rm -rf "$f" else - find "$f" -maxdepth 4 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete + $elevate find "$f" -maxdepth 4 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete test $# -eq 0 && exit $? if test -e "$f"; then echo -n "$f ($(ls -A "$f" | head -3 | paste -s -d' ')) " >&2 && diff --git a/.local/bin/scripts/rewrite b/.local/bin/scripts/rewrite index 1b1c31e..2dd34a5 100755 --- a/.local/bin/scripts/rewrite +++ b/.local/bin/scripts/rewrite @@ -1,3 +1,3 @@ #!/bin/sh # Pipe a command into this and each output line will rewrite the previous one -sed --unbuffered '2,$s|^|\\e[1A\\e[K|' | xargs -d '\n' -L 1 echo -e +sed --unbuffered '2,$s|^|\\e[1A\\e[K|' | cut -c-$(tput cols) | xargs -d '\n' -L 1 echo -e