summaryrefslogtreecommitdiff
path: root/bin/hstow
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-01-29 09:41:46 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-01-29 09:42:22 -0700
commitac6e348c052820fafd569549622246b4d238a231 (patch)
tree3be826b70dfe1c9b669672b860b602d2b457268d /bin/hstow
parent7df546cc70711d89e76417a7b5c4b14597d21608 (diff)
downloaddotfiles-ac6e348c052820fafd569549622246b4d238a231.tar.gz
hstow: use globs in .hstow-always-adopt & convert to EREs for awk
Diffstat (limited to 'bin/hstow')
-rwxr-xr-xbin/hstow15
1 files changed, 5 insertions, 10 deletions
diff --git a/bin/hstow b/bin/hstow
index c7f783ed..b54b9c94 100755
--- a/bin/hstow
+++ b/bin/hstow
@@ -77,12 +77,6 @@ readlinks () {
rm "$fields_temp" "$targets_temp"
}
-disjoin_file () {
- while read -r line; do
- [ -n "$line" ] && printf "|$2" "$line"
- done <"$DIR/$1" | sed 's#^.##; s#/#\\/#g'
-}
-
globs_to_find_args () {
local file="$DIR/$1"; shift
printf '%s\n' "$@" | cat - $([ -e "$file" ] && echo "$file") \
@@ -135,13 +129,14 @@ stow1 () {
elif ! [ -e .hstow-always-adopt ]; then
adoptp=0
else
- # EREs matching files that (i) always/often have their symlinks
+ # Globs matching files that (i) always/often have their symlinks
# replaced with regular files when applications access them; and
# (ii) we don't ever want to edit the copy under $DIR directly,
# but only via the link/copy under $HOME.
- # We might list globs in this file & convert them to EREs here.
- adoptp="$(printf 'rel ~ /^(%s)/' \
- "$(disjoin_file .hstow-always-adopt "%s")")"
+ adoptp="$(printf \
+ 'rel ~ /%s/' \
+ "$(awk -f ~/src/dotfiles/lib-src/globs2ere.awk \
+ .hstow-always-adopt)")"
fi
find . $(globs_to_find_args .hstow-local-ignore ".git/*") \
! -name . ! -type d ! -name "$cchars" ! -name .gitignore \