From 831cfcc4e76bc9af7c4f140934c52bd952122e0c Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 11 Nov 2021 20:46:39 +0100 Subject: [PATCH] config: update ignoredirs --- .config/shell/functions | 2 +- .local/bin/scripts/barg | 2 +- .local/bin/scripts/clean | 4 ++-- .local/bin/scripts/pdiff | 2 +- .local/bin/scripts/rpl | 2 +- .zprofile | 5 +++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index da39311..b4fc298 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -188,7 +188,7 @@ alias mdox="xclip -o -selection clipboard | mdo | xclip -filter" alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index' alias grp='grep --color=auto --line-number --ignore-case --binary-files=without-match --directories=skip' -grpr() { grp --color=always --recursive $(echo $IGNOREDIRS | sed 's/-x/--exclude-dir/g') "$@" | less -F } +grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -F } # Recover stray swap files from neovim alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs -r nvim" diff --git a/.local/bin/scripts/barg b/.local/bin/scripts/barg index a149096..845103b 100755 --- a/.local/bin/scripts/barg +++ b/.local/bin/scripts/barg @@ -7,5 +7,5 @@ esac name="/mnt/backup/borg::$(test -n "$name" && echo "$name" || cat /etc/hostname)-${1:-system}-$(date -u +"%y%m%d")" echo "Backing up as $name" sudo borg create --progress --stats \ - $(echo $IGNOREDIRS_PURE -x 'software-challenge/*/build' -x 'emacs/.local' | sed 's|-x \([^ ]\+\)|-e "*/\1" -e \1|g') \ + $(echo $DIRS_IGNORE_SAFE -x 'software-challenge/*/build' -x 'emacs/.local' | sed 's|-x \([^ ]\+\)|-e "*/\1" -e \1|g') \ "$name" $(test $# -eq 0 && echo etc home root || test $# -eq 1 && echo $1) "${@:2}" diff --git a/.local/bin/scripts/clean b/.local/bin/scripts/clean index 0cf3872..b2c27e4 100755 --- a/.local/bin/scripts/clean +++ b/.local/bin/scripts/clean @@ -45,8 +45,8 @@ fi highlight "d to recursively remove development caches" if [[ $1 =~ "d" ]]; then rm -rf .npm .yarn - find -name "src" -prune -o \ - -type d \( -name ".gradle" -o -name "generated" -o -name "dist-newstyle" -o -name "cache" -o -name "node_modules" -o -name "cmake_build" \) \ + arg-test -name "src" -prune -o \ + -type d \( -name 'cache' $(echo $DIRS_GENERATED | sed 's|-x \([^ ]\+\)|-o -name "\1"|g') \ -print -exec rm -r {} + -prune echo -n " " && highlight "build directories" find $DATA/2-standards/dev/aur -mindepth 2 -maxdepth 2 -type d -not -name ".*" \ diff --git a/.local/bin/scripts/pdiff b/.local/bin/scripts/pdiff index f030662..5d95a19 100755 --- a/.local/bin/scripts/pdiff +++ b/.local/bin/scripts/pdiff @@ -1,3 +1,3 @@ #!/bin/sh # Diff project directories, excluding any generated content -diff-color -r $IGNOREDIRS "$@" | less -F +diff-color -r $DIRS_IGNORE "$@" | less -F diff --git a/.local/bin/scripts/rpl b/.local/bin/scripts/rpl index 15fae89..e63c45b 100755 --- a/.local/bin/scripts/rpl +++ b/.local/bin/scripts/rpl @@ -1,7 +1,7 @@ #!/bin/sh # Use grep and sed to replace $1 with $2 recursively and print what is done grep --null --recursive --files-with-matches \ - --binary-files=without-match "--exclude-dir={$IGNOREDIRS}" "$1" | + --binary-files=without-match "--exclude-dir={$DIRS_IGNORE}" "$1" | xargs -0 sed -i "\|${1}|{ s||${2}|g w /dev/stdout diff --git a/.zprofile b/.zprofile index c0e3ad2..6680d76 100644 --- a/.zprofile +++ b/.zprofile @@ -57,8 +57,9 @@ export CONFIG_SHELLS="$XDG_CONFIG_HOME/shell" # environment which nvim >/dev/null && export EDITOR='nvim' || export EDITOR='vim' export LESS="--RAW-CONTROL-CHARS --ignore-case --LONG-PROMPT --jump-target=5 $(test $(less --version | head -1 | cut -f2 -d' ') -ge 590 && echo --incsearch)" -export IGNOREDIRS_PURE="-x .sync -x .stfolder -x .gradle -x dist_newstyle -x node_modules -x generated -x .cache -x *Cache -x .local/cache -x .local/state -x share/JetBrains -x share/Zeal -x share/syncthing -x .cpan -x .cpanm -x __pycache__" -export IGNOREDIRS="-x *build -x .git -x .idea -x out -x cache -x Partitions $IGNOREDIRS_PURE" +export DIRS_GENERATED="-x generated -x .gradle -x cmake_build -x dist-newstyle -x node_modules -x __pycache__" +export DIRS_IGNORE_SAFE="-x .sync -x .stfolder -x .cache -x *Cache -x .local/cache -x .local/state -x share/JetBrains -x share/Zeal -x share/syncthing -x .cpan -x .cpanm $DIRS_GENERATED" +export DIRS_IGNORE="-x *build -x .git -x .idea -x out -x cache -x Partitions $DIRS_IGNORE_SAFE" # red stderr test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}" # software config