zexists changes

This commit is contained in:
Daylin Morgan 2023-02-21 09:44:47 -06:00
parent 570390e192
commit f58f9a723b
9 changed files with 14 additions and 21 deletions

View file

@ -1,13 +0,0 @@
##? envsubst - fall-back wrapper in the event the envsubst command does not exist.
if (( ! $+commands[envsubst] )); then
function envsubst {
command envsubst "$@"
}
else
function envsubst {
python -c 'import os,sys;[sys.stdout.write(os.path.expandvars(l)) for l in sys.stdin]'
}
fi
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,3 +1,5 @@
#!/usr/bin/env zsh
function source-zshcmdd { function source-zshcmdd {
setopt extended_glob setopt extended_glob
@ -35,15 +37,13 @@ function source-zshcmdd {
source-zshcmdd source-zshcmdd
function zshdir-decode { function zshdir-decode {
# echo ${${1//--DOLLAR--/$}//--SLASH--/\/} | envsubst
# for now just remove the 'dir' part # for now just remove the 'dir' part
# :3 for 'dir' echo ${${1//-SLASH-//}/-DOT-/\.}
echo ${${1//-DOLLAR-/$}//-SLASH-/\/} | envsubst
} }
function zshdir-encode { function zshdir-encode {
# dir is hardcoded... # dir is hardcoded...
echo dir${${1//${HOME}/\-DOLLAR-HOME}//\//-SLASH-} echo dir${${1//${HOME}\//}//\//-SLASH-}
} }
@ -82,12 +82,11 @@ function source-zshpathd {
return 1 return 1
fi fi
# ignore files that begin with a tilde # ignore files that begin with a tilde
case ${rcfile:t} in '~'*) continue;; esac case ${rcfile:t} in '~'*) continue;; esac
# remove 'dir' from name # remove 'dir' from name
name=${${rcfile:t}/$pathtype/} name=${${rcfile:t}/${pathtype}-/}
directory=$(zshdir-decode ${name}) directory=$HOME/$(zshdir-decode ${name})
# source files only if exe with that name exists # source files only if exe with that name exists
if [[ -d $directory ]]; then if [[ -d $directory ]]; then
source $rcfile source $rcfile
@ -101,3 +100,4 @@ function source-zshpathd {
source-zshpathd source-zshpathd
unset _envsubst

View file

@ -0,0 +1,6 @@
#!/usr/bin/env zsh
function envsubst {
python -c 'import os,sys;[sys.stdout.write(os.path.expandvars(l)) for l in sys.stdin]'
}

View file

@ -3,6 +3,6 @@ alias t-labbook="$DOTFILES_DIR/tmux/labbook.sh"
alias tmux="tmux -f $HOME/.config/tmux/tmux.conf" alias tmux="tmux -f $HOME/.config/tmux/tmux.conf"
alias t='tmux' alias t='tmux'
alias ta='tmux attach -t' alias ta='tmux attach -t'
alias tn='tmux new-session' alias tn='tmux new-session -s'
alias tl='tmux list-sessions' alias tl='tmux list-sessions'