bin: tweaks
This commit is contained in:
parent
4dc3bfeb84
commit
c44400ed52
|
@ -85,7 +85,7 @@ for arg; do
|
||||||
test -L "$arg" || continue
|
test -L "$arg" || continue
|
||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
case "$(file "$arg")" in
|
case "$(file --dereference "$arg")" in
|
||||||
(*\ ?udio*)
|
(*\ ?udio*)
|
||||||
# TODO preconvert aac - |*\ ADTS\ *
|
# TODO preconvert aac - |*\ ADTS\ *
|
||||||
img="$tmpfile.png"
|
img="$tmpfile.png"
|
||||||
|
@ -112,6 +112,7 @@ for arg; do
|
||||||
esac; fi
|
esac; fi
|
||||||
;;
|
;;
|
||||||
(*:\ *database*) highlight "Tables" && sqlite3 "$arg" ".tables";;
|
(*:\ *database*) highlight "Tables" && sqlite3 "$arg" ".tables";;
|
||||||
|
(*:\ data) ;;
|
||||||
(*) bat+=("$arg")
|
(*) bat+=("$arg")
|
||||||
timga+=("$arg")
|
timga+=("$arg")
|
||||||
continue;;
|
continue;;
|
||||||
|
@ -172,11 +173,12 @@ if test "$ls" -o $# -le $(echo "$flags" | wc -w); then
|
||||||
checkperm .
|
checkperm .
|
||||||
# Alternative: find -exec ls -dl {} +
|
# Alternative: find -exec ls -dl {} +
|
||||||
{
|
{
|
||||||
|
# TODO don't use * for ls array as spaces go awry
|
||||||
timeout .1s sh -c "
|
timeout .1s sh -c "
|
||||||
if which exa 2>/dev/null >&2
|
if which exa 2>/dev/null >&2
|
||||||
then exa --color=always --long --group --classify --group-directories-first --all --all $flags '${ls[@]:-.}'
|
then exa --color=always --long --group --classify --group-directories-first --all --all $flags ${ls[*]:-.}
|
||||||
else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags '${ls[@]:-.}'
|
else $elevate ls -l $(test $# -gt ${#ls[@]} && echo '-d') --color=always --human-readable --si --group-directories-first --file-type --dereference-command-line-symlink-to-dir --all $flags ${ls[*]:-.}
|
||||||
fi
|
fi
|
||||||
" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags "${ls[@]:-.}"
|
" || $elevate ls $(test $# -gt ${#ls[@]} && echo "-d") --color=always --human-readable --si --dereference-command-line --all --sort=none $flags "${ls[@]:-.}"
|
||||||
} | $pager
|
} | $pager --quit-if-one-screen
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Colorize with diffr
|
# Colorize with diffr
|
||||||
diff --color=always -U 2 "$@" |
|
diff --color=always --unified=2 "$@" |
|
||||||
diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33
|
diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33
|
||||||
|
|
|
@ -22,7 +22,7 @@ case "$command" in
|
||||||
(commit)
|
(commit)
|
||||||
makepkg --printsrcinfo > .SRCINFO
|
makepkg --printsrcinfo > .SRCINFO
|
||||||
git add -f .SRCINFO
|
git add -f .SRCINFO
|
||||||
git commit -v "$@"
|
git commit -v "$@";;
|
||||||
(push)
|
(push)
|
||||||
updpkgsums
|
updpkgsums
|
||||||
git add -f *.install 2>/dev/null || true
|
git add -f *.install 2>/dev/null || true
|
||||||
|
|
|
@ -10,7 +10,7 @@ fzfpipe() {
|
||||||
# and return a newline-separated list of selected files
|
# and return a newline-separated list of selected files
|
||||||
cut -z -c2- |
|
cut -z -c2- |
|
||||||
git fzf-diff --read0 -d' ' --nth=2.. --bind="alt-enter:execute($EDITOR '$(git rev-parse --show-toplevel)/{2..}')" \
|
git fzf-diff --read0 -d' ' --nth=2.. --bind="alt-enter:execute($EDITOR '$(git rev-parse --show-toplevel)/{2..}')" \
|
||||||
--preview="test {1} != \? && git diff --color HEAD -U5 -- {2..} | $(git config interactive.diffFilter) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %" |
|
--preview="test {1} != \? && git diff --color HEAD --unified=4 -- {2..} | $(git config interactive.diffFilter) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %" |
|
||||||
cut -c3-
|
cut -c3-
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
upCount=$(git rev-list --count HEAD...@{push} 2>/dev/null)
|
upCount=$(git rev-list --count HEAD...@{push} 2>/dev/null)
|
||||||
count=$(expr ${upCount:-0} + 3 \& ${upCount:-0} \> 3 \& ${upCount:-0} \< 6 \| 6)
|
count=$(expr ${upCount:-0} + 3 \& ${upCount:-0} \> 3 \& ${upCount:-0} \< 6 \| 6)
|
||||||
git --no-pager lo -$count --color=always --graph HEAD @{upstream} || git --no-pager lo -7
|
git --no-pager lo -$count --color=always --graph HEAD @{upstream} "$@" || git --no-pager lo -7 "$@"
|
||||||
|
|
|
@ -7,7 +7,7 @@ checkaccess -w "$@" || elevate=sudo
|
||||||
! $elevate test -e "$1" && echo "$1 does not exist" && exit 1
|
! $elevate test -e "$1" && echo "$1 does not exist" && exit 1
|
||||||
|
|
||||||
dir="$(dirname "$1")"
|
dir="$(dirname "$1")"
|
||||||
test "$(lsattr -d "$dir" | cut -c6 2>/dev/null)" = a && setappend=true
|
test "$(lsattr -d "$dir" 2>/dev/null | cut -c6)" = a && setappend=true
|
||||||
test -z "$setappend" || sudo chattr -V -a "$dir"
|
test -z "$setappend" || sudo chattr -V -a "$dir"
|
||||||
|
|
||||||
$elevate mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)
|
$elevate mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Diff project directories, excluding any generated content
|
# Diff project directories, excluding any generated content
|
||||||
diff-color -r $DIRS_IGNORE "$@" | less -F
|
diff-color --recursive $DIRS_IGNORE "$@" | less -F
|
||||||
|
|
|
@ -13,7 +13,7 @@ sig=$tmp_base/signature_offset.pdf
|
||||||
result="${1%.pdf}_${5:-signed}.pdf"
|
result="${1%.pdf}_${5:-signed}.pdf"
|
||||||
|
|
||||||
pdfjam $quiet "$signature" --outfile "$sig" --papersize "{595pt, 842pt}" --noautoscale true \
|
pdfjam $quiet "$signature" --outfile "$sig" --papersize "{595pt, 842pt}" --noautoscale true \
|
||||||
--offset "${2:-0}pt ${3:-0}pt" --scale "${4:-1}"
|
--offset "${2:--160}pt ${3:--310}pt" --scale "${4:-1}"
|
||||||
pdfjam $quiet "$1" last "$sig" --outfile "$tmp_signed" --delta "0 -842pt" --nup "1x2" --fitpaper true
|
pdfjam $quiet "$1" last "$sig" --outfile "$tmp_signed" --delta "0 -842pt" --nup "1x2" --fitpaper true
|
||||||
|
|
||||||
timg "$tmp_signed"
|
timg "$tmp_signed"
|
||||||
|
|
Loading…
Reference in New Issue