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

2
env
View file

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