From 5dce61fb4506973d583cb5b5590581f3ecc20f2d Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 7 May 2021 12:31:14 +0200 Subject: [PATCH] bin: tweak flags --- .config/shell/functions | 2 +- .local/bin/scripts/b | 2 +- .local/bin/scripts/ex | 2 +- .local/bin/scripts/st-diff | 7 ++++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index 3b8c175..22f1c9a 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -6,7 +6,7 @@ alias -g G="| grp" alias -g X="| xargs" alias -g X1="| xargs -n 1" alias -g XC="| xclip -selection clipboard" -alias -g L="--color=always | less" +alias -g L="--color=always | ${PAGER:-less}" fi alias info='info --vi-keys' diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 9a5b391..51b4b43 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -12,5 +12,5 @@ case "$(file --dereference --mime "$last")" in *inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";; *binary) ;; *) $(test -f "$last" -a ! -r "$last" && echo "sudo") bat --style header "$@" - stat -c '%A size %sB, birth: %.10w mod %.10y' "$last";; + stat --format '%A size %sB, birth: %.10w mod %.10y' "$last";; esac diff --git a/.local/bin/scripts/ex b/.local/bin/scripts/ex index 4fabf60..35f4657 100755 --- a/.local/bin/scripts/ex +++ b/.local/bin/scripts/ex @@ -12,7 +12,7 @@ for arg do *.tar) tar xf "$arg" ;; *.tbz2) tar xjf "$arg" ;; *.tgz) tar xzf "$arg" ;; - *.zip) unzip "$arg" ;; + *.zip|*.jar) unzip "$arg" ;; *.Z) uncompress "$arg";; *.7z) 7z x "$arg" ;; *.deb) ar x "$arg" ;; diff --git a/.local/bin/scripts/st-diff b/.local/bin/scripts/st-diff index 8ce6c9f..4995e16 100755 --- a/.local/bin/scripts/st-diff +++ b/.local/bin/scripts/st-diff @@ -1,7 +1,12 @@ #!/bin/sh +stats() { + stat --format '%n %A size %sB, birth: %.10w mod %.10y' "$@" +} if test "$#" -gt 0 then - dif "$(st-unarchive "$1")" "$@" + orig="$(st-unarchive "$1")" + ( stats "$orig" "$1"; dif "$orig" "$@" ) | + less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen test "$?" -eq "2" && exit 1 echo "y|r to restore, n|d to delete" read reply