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
|
||||
}
|
||||
|
||||
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"
|
||||
cd() {
|
||||
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
|
||||
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
|
||||
then
|
||||
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, m to merge"
|
||||
read reply
|
||||
case "$reply" in
|
||||
(y|r) st-restore "$1";;
|
||||
(n|d) rm -v "$1";;
|
||||
(m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";;
|
||||
esac
|
||||
else find -name '*sync-conflict*' -exec st-diff '{}' \;
|
||||
if test -n "$quick"
|
||||
then stats "$orig" "$1"
|
||||
else
|
||||
( 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, m to merge"
|
||||
read reply
|
||||
case "$reply" in
|
||||
(y|r) st-restore "$1";;
|
||||
(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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
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