Improve compatibility with older versions of zsh

This commit is contained in:
Henrik Lissner 2018-01-01 01:15:05 -05:00
parent 58e2577e66
commit f26719d7ac
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

12
deploy
View file

@ -32,7 +32,7 @@ function _topic-do {
fi fi
} }
function _topics { function _topics {
local topics=( "$DOTFILES_DATA"/*.topic(N) ) local topics; topics=( "$DOTFILES_DATA"/*.topic(N) )
echo ${${${topics[@]#$DOTFILES_DATA/}%.topic}/$SEP//} echo ${${${topics[@]#$DOTFILES_DATA/}%.topic}/$SEP//}
} }
@ -47,8 +47,8 @@ function mklink {
shift shift
fi fi
local flags="-svf" local flags="-svf"
local srcs=( ${@:1:-1} )
local dest=${@[-1]} local dest=${@[-1]}
local srcs; srcs=( ${@:1:-1} )
if [[ $dest == */ && ! -d $dest ]]; then if [[ $dest == */ && ! -d $dest ]]; then
mkdir -p $dest mkdir -p $dest
elif [[ ! -d ${dest%/*} ]]; then elif [[ ! -d ${dest%/*} ]]; then
@ -91,7 +91,7 @@ function topic-init {
local tpath="$DOTFILES/$topic" local tpath="$DOTFILES/$topic"
local tsympath="$(topic-path $topic)" local tsympath="$(topic-path $topic)"
if [[ -d "$topic/bin" ]]; then if [[ -d "$topic/bin" ]]; then
export path=( $tpath/bin $path ) export path; path=( $tpath/bin $path )
echo-ok "$topic: added $topic/bin to PATH, temporarily" echo-ok "$topic: added $topic/bin to PATH, temporarily"
fi fi
@ -128,8 +128,8 @@ function topic-remove {
} }
function clean { function clean {
local paths=( $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME $XDG_BIN_HOME ) local paths; paths=( $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME $XDG_BIN_HOME )
local links=( ~/.*(-@DN) ${^paths}/**(-@DN)) local links; links=( ~/.*(-@DN) ${^paths}/**(-@DN))
if [[ ${#links[@]} > 1 ]]; then if [[ ${#links[@]} > 1 ]]; then
echo-info "Removing dead dotfile symlinks..." echo-info "Removing dead dotfile symlinks..."
for link in "${links[@]}"; do for link in "${links[@]}"; do
@ -140,7 +140,7 @@ function clean {
fi fi
# Remove empty dotfile folders # Remove empty dotfile folders
local dirs=( ${^paths}/**(N/^F) ~/.*(N/^F) ) local dirs; dirs=( ${^paths}/**(N/^F) ~/.*(N/^F) )
if [[ ${#dirs[@]} > 1 ]]; then if [[ ${#dirs[@]} > 1 ]]; then
echo-info "Removing empty dotfile directories..." echo-info "Removing empty dotfile directories..."
for dir in "${dirs[@]}"; do for dir in "${dirs[@]}"; do