Improve zsh compatibility in deploy/env scripts

This commit is contained in:
Henrik Lissner 2018-01-01 00:58:53 -05:00
parent 7ed5bc9a86
commit 58e2577e66
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 6 additions and 6 deletions

10
deploy
View file

@ -95,7 +95,7 @@ function topic-init {
echo-ok "$topic: added $topic/bin to PATH, temporarily" echo-ok "$topic: added $topic/bin to PATH, temporarily"
fi fi
if [[ $LINK ]] || ! topic-enabled-p $topic; then if [[ -n $LINK ]] || ! topic-enabled-p $topic; then
local op=install local op=install
mklink $tpath $tsympath mklink $tpath $tsympath
_topic-do $topic link _topic-do $topic link
@ -120,7 +120,7 @@ function topic-remove {
continue continue
fi fi
[[ $INHIBIT_INIT ]] || _topic-do $topic clean [[ -z $INHIBIT_INIT ]] && _topic-do $topic clean
_exec rm -f "$(topic-path $topic)" && \ _exec rm -f "$(topic-path $topic)" && \
echo-ok "Removed $topic" || \ echo-ok "Removed $topic" || \
echo-fail "Couldn't remove $topic" echo-fail "Couldn't remove $topic"
@ -182,16 +182,16 @@ EOL
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
if [[ $LIST ]]; then if [[ -n $LIST ]]; then
_topics | tr ' ' $'\n' _topics | tr ' ' $'\n'
else else
pushd -qL "$DOTFILES" pushd -qL "$DOTFILES"
if [[ $REMOVE ]]; then if [[ -n $REMOVE ]]; then
topic-remove ${TARGETS:-$@} topic-remove ${TARGETS:-$@}
else else
topic-init ${TARGETS:-$@} topic-init ${TARGETS:-$@}
fi fi
[[ $CLEAN ]] && clean [[ -n $CLEAN ]] && clean
popd -q popd -q
fi fi
fi fi

2
env
View file

@ -61,7 +61,7 @@ function _ensure_repo {
elif [[ $target =~ "^[^/]+$" ]]; then elif [[ $target =~ "^[^/]+$" ]]; then
url=git@github.com:$USER/$target.git url=git@github.com:$USER/$target.git
fi fi
[[ ${dest%/*} ]] && mkdir -p ${dest%/*} [[ -n ${dest%/*} ]] && mkdir -p ${dest%/*}
git clone --recursive "$url" "$dest" || return 1 git clone --recursive "$url" "$dest" || return 1
fi fi
} }