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,10 +1,14 @@
|
||||||
#!/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")"
|
||||||
|
if test -n "$quick"
|
||||||
|
then stats "$orig" "$1"
|
||||||
|
else
|
||||||
( stats "$orig" "$1"; dif "$orig" "$@" ) |
|
( stats "$orig" "$1"; dif "$orig" "$@" ) |
|
||||||
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|
||||||
test "$?" -eq "2" && exit 1
|
test "$?" -eq "2" && exit 1
|
||||||
|
@ -15,5 +19,6 @@ if test "$#" -gt 0
|
||||||
(n|d) rm -v "$1";;
|
(n|d) rm -v "$1";;
|
||||||
(m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";;
|
(m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";;
|
||||||
esac
|
esac
|
||||||
else find -name '*sync-conflict*' -exec st-diff '{}' \;
|
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