config: script fixes
This commit is contained in:
parent
75316b70c2
commit
bdc2e2c94e
|
@ -203,7 +203,7 @@ alias usergroups="cat /etc/passwd | cut -d':' -f1 | xargs -n 1 id"
|
|||
p() { pass "$@" || pass edit "$@"; }
|
||||
|
||||
alias omd="(echo '#+OPTIONS: tags:nil'; xclip -o -selection clipboard) | pandoc -f org-auto_identifiers -t markdown --wrap preserve | xclip -filter"
|
||||
alias mdo="pandoc -f gfm-ascii_identifiers-gfm_auto_identifiers -t org --wrap preserve"
|
||||
alias mdo="pandoc -f gfm-ascii_identifiers-gfm_auto_identifiers -t org-auto_identifiers --wrap preserve"
|
||||
alias mdox="xclip -o -selection clipboard | mdo | xclip -filter"
|
||||
|
||||
alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#assume_yes = true
|
||||
|
||||
# Disable specific steps - same options as the command line flag
|
||||
disable = ["npm", "nix", "emacs"]
|
||||
disable = ["node", "pnpm", "nix", "emacs", "pacdiff"]
|
||||
|
||||
# Ignore failures for these steps
|
||||
#ignore_failures = ["powershell"]
|
||||
|
|
|
@ -54,7 +54,8 @@ for arg; do
|
|||
test -f "$tmpfile-1.png" || pdftoppm -r 70 "$arg" "$tmpfile" -l $(expr $grid '*' 2)
|
||||
timg -W --grid=$grid "$tmpfile"*
|
||||
;;
|
||||
(*/x-xcf*) ;;
|
||||
(*/x-xcf*) convert -flatten "$arg" png:"$tmpfile"
|
||||
timg+=("$tmpfile");;
|
||||
(*\ video/*)
|
||||
suffix=_thumbs.jpg
|
||||
mtn -i -t -W -r2 -D6 -b 0,6 -c $grid -w $(expr $(tput cols) '*' 20) \
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
typeset -A _clean_map
|
||||
_clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [v]=/var/cache)
|
||||
# Directories to always clean
|
||||
_clean_folders=(~/.ant ~/.autopsy ~/.bundle ~/.cache ~/.cargo ~/.cpanm ~/.docker ~/.electron ~/.electron-gyp ~/.gradle ~/.gradle-kotlin-dsl ~/.hex ~/.java ~/.kscript ~/.konan ~/.m2 ~/.mix ~/.nix-defexpr ~/.node-gyp ~/.npm ~/.nv ~/.openjfx ~/.parallel ~/.stack ~/.surf ~/.texlive ~/.yarn luametatex-cache
|
||||
~/.lesshst ~/.rubberband.wisdom.d ~/.yarnrc)
|
||||
_clean_home=(.ant .autopsy .bundle .cache .cargo .cpanm .docker .electron .electron-gyp .gradle .gradle-kotlin-dsl .hex .java .kscript .konan .m2 .mix .nix-defexpr .node-gyp .node_modules .npm .pnpm-store .nv .openjfx .parallel .stack .surf .texlive .yarn luametatex-cache
|
||||
.lesshst .python_history .rubberband.wisdom.d .yarnrc)
|
||||
|
||||
[[ $1 =~ "." ]] && local=pwd
|
||||
[[ $1 =~ "i" ]] && i=-i
|
||||
|
@ -13,10 +12,10 @@ dir="$("$local" 2>/dev/null || echo "$HOME")"
|
|||
|
||||
df --output="source,avail" -h $(test -n "$local" && echo ".") "$dir"
|
||||
|
||||
highlight "clean home"
|
||||
for f in ${_clean_folders[@]}
|
||||
do "$local" >/dev/null 2>&1 && f="$(echo "$f" | sed "s|$HOME|$($loc)|")"
|
||||
test -f $f || test -d $f && echo "Removing superfluous $f" && rm -rf $i $f
|
||||
highlight "cleaning home"
|
||||
for f in ${_clean_home[@]}
|
||||
do path="$dir/$f"
|
||||
test -f "$path" || test -d "$path" && echo "Removing superfluous $path" && rm -rf $i "$path"
|
||||
done
|
||||
find "$dir" -maxdepth 2 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
# Remove one level of folders
|
||||
find -mindepth 1 -maxdepth 1 -exec sh -c 'mv -nv {}/* . && rm -dv {}' \;
|
|
@ -9,7 +9,7 @@ listconf() {
|
|||
-maxdepth 4 -follow \( -name Partitions -o -name mdn -o -name .git -o -name .local -o -name plugged \) -prune -o \
|
||||
! -iname "*.markdown" -a ! -iname "*.md" -a ! -iname "*.org" \
|
||||
-type f -readable -exec grep -lI '' {} + 2>/dev/null;
|
||||
find /boot -name "*.c*";
|
||||
find /boot -name "*.c*" 2>/dev/null;
|
||||
} | dedup
|
||||
}
|
||||
|
||||
|
|
|
@ -3,15 +3,16 @@
|
|||
# adapted and improved from the commonly circulating version
|
||||
# detects whether unpacking into a subfolder is sensible
|
||||
# and shows progress indications for some operations
|
||||
# optdepends: rewrite(in dotfiles)
|
||||
# optdepends: rewrite(part of my dotfiles)
|
||||
for arg do
|
||||
if test -r "$arg"; then
|
||||
path="$(realpath "$arg")"
|
||||
name="$(basename "${path%.*}")"
|
||||
namepart="$name.part"
|
||||
(
|
||||
if test "$(ls -U | wc -l)" -gt 2; then
|
||||
mkdir -p "$name"
|
||||
cd "$name"
|
||||
mkdir -p "$namepart"
|
||||
cd "$namepart"
|
||||
fi
|
||||
echo "Extracting $arg into $PWD"
|
||||
case "$arg" in
|
||||
|
@ -28,8 +29,11 @@ for arg do
|
|||
(*.Z) uncompress "$path";;
|
||||
(*) echo "'$arg' cannot be extracted by ex" >&2;;
|
||||
esac
|
||||
test "$(ls -U | wc -l)" -lt 3 &&
|
||||
mv */* . && find -empty -delete
|
||||
test "$(basename "$PWD")" = "$namepart" &&
|
||||
if test "$(ls -U | wc -l)" -lt 3
|
||||
then mv * .. && cd .. && rm -d "$namepart"
|
||||
else mv "$namepart" "$name"
|
||||
fi
|
||||
)
|
||||
else
|
||||
echo "'$1' is not a readable file"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
# open info-page, man-page or command help
|
||||
# depends: unbuffer
|
||||
# optdepends: highlight(dotfiles)
|
||||
paginate="${PAGER:-less} +Gg"
|
||||
test "$1" = "-d" && browse=1 && shift
|
||||
# TODO resolve aliases
|
||||
|
@ -9,11 +11,12 @@ case $1 in
|
|||
# need to install zsh-doc package for info pages
|
||||
info --vi-keys "$(test "$last" != zsh && echo "--index-search=$last")" zsh ||
|
||||
LESS="$LESS +/^ *$last *\\[" man zshall;;
|
||||
(vlc) unbuffer vlc --full-help "${@:2}" | $paginate;;
|
||||
(gh|chordpro|bat|pdfjam|reflector) unbuffer "$@" --help | $paginate;;
|
||||
(plantuml) unbuffer "$@" -help | $paginate;;
|
||||
(gh|chordpro|bat|pdfjam|reflector|topgrade) unbuffer "$@" --help | $paginate;;
|
||||
(caddy|stretchly|go) "$1" help "${@:2}" | $paginate;;
|
||||
(plantuml) unbuffer "$@" -help | $paginate;;
|
||||
(kdeconnect*) kdeconnect-cli --help-all "${@:2}" | $paginate;;
|
||||
(vlc) unbuffer vlc --full-help "${@:2}" | $paginate;;
|
||||
(pandoc) man pandoc; highlight "Extensions" && pandoc --list-extensions;;
|
||||
(*) man "$@" ||
|
||||
{ info "$1" -w | grep -v "manpages" && pinfo "$@"; } ||
|
||||
if which "$1" >/dev/null; then "$@" --help; "$@" -help 2>&1 | $paginate; fi;;
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
#!/bin/sh
|
||||
#!/bin/sh -e
|
||||
# Remove recursively safely
|
||||
case "$1" in ([0-9]) depth=$1; shift;; esac
|
||||
for f in "${@-.}"
|
||||
do
|
||||
test -w "$f" && elevate="" || elevate=sudo
|
||||
if test -d "$f"; then
|
||||
find "$f" -maxdepth 4 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
|
||||
if test -d "$f"
|
||||
then find "$f" -maxdepth 4 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
|
||||
test $# -eq 0 && exit $?
|
||||
if test -e "$f/.git" || test -e "$f/packed-refs"
|
||||
then echo -n "Force delete git project $f? "
|
||||
read answer
|
||||
test "$answer" = "y" &&
|
||||
$elevate rm -rf "$f"
|
||||
else test -e "$f" &&
|
||||
echo -n "$f ($(ls -A $f | head -3 | paste -s -d' ')) " >&2 &&
|
||||
$elevate rm -rI "$f"
|
||||
then echo -n "Force delete git project $f? "
|
||||
read answer
|
||||
test "$answer" = "y" &&
|
||||
$elevate rm -rf "$f"
|
||||
else test -e "$f" &&
|
||||
echo -n "$f ($(ls -A "$f" | head -3 | paste -s -d' ')) " >&2 &&
|
||||
$elevate rm -rI "$f"
|
||||
fi
|
||||
else $elevate rm -i "$f"
|
||||
else $elevate rm -i "$f"
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue