Skip to content

Commit

Permalink
Ensure rm and mv always use the base command
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmc3 committed Jul 18, 2024
1 parent f6117f4 commit 3b2de5a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions functions/antidote-purge
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
if [[ ${REPLY:u} == "Y" ]]; then
local dtstmp=$(date -u '+%Y%m%d_%H%M%S')
mv -f "${bundlefile:r}.zsh" "${bundlefile:r}.${dtstmp}.bak"
command mv -f "${bundlefile:r}.zsh" "${bundlefile:r}.${dtstmp}.bak"
print "'"${bundlefile:r}.zsh"' backed up to '${bundlefile:t:r}.${dtstmp}.bak'"
fi
fi
Expand Down Expand Up @@ -75,7 +75,7 @@
if [[ -e "$bundlefile" ]]; then
local tmpfile="${bundlefile}.antidote.tmp"
$__adote_awkcmd -v pat="$bundle" '$0~"^[[:blank:]]*"pat{print "# " $0;next}1' <$bundlefile >|$tmpfile
mv -f "$tmpfile" "$bundlefile" || rm -f "$tmpfile"
command mv -f "$tmpfile" "$bundlefile" || command rm -f "$tmpfile"
print "Bundle '$bundle' was commented out in '$bundlefile'."
fi
fi
Expand Down
6 changes: 5 additions & 1 deletion functions/antidote-update
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
local bundledir url repo

# remove zcompiled files
rm -rf -- $(antidote-home)/**/*.zwc(N)
command rm -rf -- $(antidote-home)/**/*.zwc(N)

# remove check file
local loadable_check_path="$(antidote-home)/.antidote.load"
[[ -r "$loadable_check_path" ]] && command rm -- "$loadable_check_path"

# update all bundles
for bundledir in $(antidote-list --dirs); do
Expand Down
6 changes: 3 additions & 3 deletions tests/functions/t_setup_real
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
# replace .zsh_plugins.txt with real versions
local file
for file in .zsh_plugins.txt .zsh_plugins.zsh; do
[[ -f $ZDOTDIR/$file ]] && rm -f -- "$ZDOTDIR/$file"
[[ -f $testdir/real/$file ]] && rm -f -- "$testdir/real/$file"
[[ -f $ZDOTDIR/$file ]] && command rm -f -- "$ZDOTDIR/$file"
[[ -f $testdir/real/$file ]] && command rm -f -- "$testdir/real/$file"
done

# clean out antidote home
[[ -d $ANTIDOTE_HOME ]] && rm -rf -- "$ANTIDOTE_HOME"
[[ -d $ANTIDOTE_HOME ]] && command rm -rf -- "$ANTIDOTE_HOME"
mkdir -p "$ANTIDOTE_HOME"

# source antidote
Expand Down
2 changes: 1 addition & 1 deletion tests/functions/t_teardown
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
source <(printf '%s\n' $T_PREV_ZSTYLES)

# remove tempdir
[[ -d "$T_TEMPDIR" ]] && rm -rf -- "$T_TEMPDIR"
[[ -d "$T_TEMPDIR" ]] && command rm -rf -- "$T_TEMPDIR"

# remove vars
for var in \
Expand Down
2 changes: 1 addition & 1 deletion tools/buildman
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
0=${(%):-%x}
BASEDIR=${0:a:h:h}
TMPDIR=$BASEDIR/.tmp/buildman
[[ -d $TMPDIR ]] && rm -rf $TMPDIR
[[ -d $TMPDIR ]] && command rm -rf $TMPDIR
mkdir -p $TMPDIR

sedi() {
Expand Down

0 comments on commit 3b2de5a

Please sign in to comment.