bin: various little script insertions

This commit is contained in:
xeruf 2022-09-16 14:48:43 +02:00
parent 2c1dab2a28
commit ae99fab61b
5 changed files with 6 additions and 4 deletions

View File

@ -80,6 +80,7 @@ fi
highlight "o :: optimize space extensively"
if [[ $1 =~ "o" ]]; then
sudo rm -rf "$XDG_DATA_HOME/baloo"
docker image prune
which yay &>/dev/null && yay -Sc --noconfirm
nix-collect-garbage -d
nix-store --optimize

View File

@ -1,6 +1,6 @@
#!/bin/bash -e
# interactive diff with pagination and nice coloring
# TODO diff sqlite repos
# TODO diff sqlite repos with sqldiff
if file --brief --mime "$1" "$2" | grep --quiet audio
then ff() { ffprobe -loglevel warning -print_format default=noprint_wrappers=1 -show_format -pretty "$@"; }
$(test $(tput cols) -gt 120 && echo "diff --color=always --side-by-side" || echo "diff-color") --report-identical-files --label="$1" --label="$2" <(ff "$1") <(ff "$2")

View File

@ -5,7 +5,7 @@
test "$1" = "-w" && write=true && shift
disk="${1:-$(df --output=source . | tail -1)}"
if test "$write"
then exec &> >(tee "disktest-$(date +%F)")
then exec &> >(tee ".disktest-$(date +%F)")
fi
highlight() { echo "$1"; }

View File

@ -18,7 +18,7 @@ showinfo() {
cmd="$1"
case "$cmd" in
# TODO extract help in standard format from scripts
(gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff) unbuffer "$@" --help | $paginate;;
(rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff) unbuffer "$@" --help | $paginate;;
(caddy|stretchly|go|fossil) test "$cmd" = "fossil" -a $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")" && fossil ui "$repo" && exit
# TODO view fossil ui in terminal
shift

View File

@ -3,7 +3,8 @@
set -eo pipefail
_help="$0 <device> [mountpoint] [options...]"
case $1 in
("") arg=$(lsblk --list --noheadings --output name,label,fstype,mountpoint |
("") # TODO include size
arg=$(lsblk --list --noheadings --output name,label,fstype,mountpoint |
grep -v '/' | grep ".\+ [^ ]\+" | fzf --select-1 --exit-0 |
sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/");;
("--help") echo "$_help" && exit 0;;