bin: revamp some scripts
This commit is contained in:
parent
4a458a3c00
commit
90a1e8f906
|
@ -90,12 +90,6 @@ edshell() {
|
||||||
test "$checksum" != "$(md5sum $file)" && source "$HOME/.zprofile" && exec $SHELL
|
test "$checksum" != "$(md5sum $file)" && source "$HOME/.zprofile" && exec $SHELL
|
||||||
}
|
}
|
||||||
|
|
||||||
edbin() {
|
|
||||||
file="$(f=$(which $1) && test -f "$f" && echo $f || echo "$HOME/.local/bin/scripts/$1")"
|
|
||||||
edit "$file"
|
|
||||||
case "$file" in ($HOME*) yadm add "$file";; esac
|
|
||||||
}
|
|
||||||
|
|
||||||
alias l="ls -l --almost-all --human-readable --group-directories-first --file-type"
|
alias l="ls -l --almost-all --human-readable --group-directories-first --file-type"
|
||||||
cd() {
|
cd() {
|
||||||
test ! -d "$1" && test $# -eq 1 && dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) &&
|
test ! -d "$1" && test $# -eq 1 && dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) &&
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
file="$(f="$(which $1 2>/dev/null)" && test -f "$f" && echo $f || echo "$HOME/.local/bin/scripts/$1")"
|
||||||
|
edit "$file"
|
|
@ -1,19 +1,24 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
stats() {
|
stats() {
|
||||||
stat --format '%n %A size %sB, birth: %.10w mod %.10y' "$@"
|
stat --format '%.10y %n %sB - birth %.10w' "$@"
|
||||||
}
|
}
|
||||||
|
test "$1" = "-q" && quick=-q && shift
|
||||||
if test "$#" -gt 0
|
if test "$#" -gt 0
|
||||||
then
|
then
|
||||||
orig="$(st-unarchive "$1")"
|
orig="$(st-unarchive "$1")"
|
||||||
( stats "$orig" "$1"; dif "$orig" "$@" ) |
|
if test -n "$quick"
|
||||||
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
then stats "$orig" "$1"
|
||||||
test "$?" -eq "2" && exit 1
|
else
|
||||||
echo "y|r to restore, n|d to delete, m to merge"
|
( stats "$orig" "$1"; dif "$orig" "$@" ) |
|
||||||
read reply
|
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
||||||
case "$reply" in
|
test "$?" -eq "2" && exit 1
|
||||||
(y|r) st-restore "$1";;
|
echo "y|r to restore, n|d to delete, m to merge"
|
||||||
(n|d) rm -v "$1";;
|
read reply
|
||||||
(m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";;
|
case "$reply" in
|
||||||
esac
|
(y|r) st-restore "$1";;
|
||||||
else find -name '*sync-conflict*' -exec st-diff '{}' \;
|
(n|d) rm -v "$1";;
|
||||||
|
(m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
else find -name '*sync-conflict*' -exec st-diff $quick '{}' \;
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
case "$1" in [0-9]) depth=$1; shift;; esac
|
case "$1" in [0-9]) depth=$1; shift;; esac
|
||||||
tree -a -L ${depth:-3} --du -h -C "$@" | ${PAGER:-less}
|
tree -a --dirsfirst -L ${depth:-3} --du -h -C "$@" | ${PAGER:-less}
|
||||||
|
|
Loading…
Reference in New Issue