1
0
Fork 0
mirror of https://github.com/MillironX/dotfiles.git synced 2024-12-03 09:49:55 +00:00

refactor: Replace shell path evaluation with Chezmoi evaluation

This commit is contained in:
Thomas A. Christensen II 2023-04-15 17:16:40 -05:00
parent 7319c73820
commit 1e8b917803
Signed by: millironx
GPG key ID: 09335146883990B9

View file

@ -1,22 +1,13 @@
# Only create aliases if the underlying programs are available
# This allows portability between machines in different states
alias_if_exists () {
ALIAS=${1}
COMMAND=${2}
ARGS=${3}
if [ $(command -v $COMMAND) ]; then
if [ -n "$ARGS" ]; then
alias $ALIAS="$COMMAND $ARGS"
else
alias $ALIAS="$COMMAND"
fi
fi
}
# Context-sensitive aliases
alias_if_exists bat batcat
alias_if_exists cat bat
alias_if_exists ls lsd
{{- if lookPath "batcat" }}
alias bat=batcat
{{- end }}
{{- if or (lookPath "bat") (lookPath "batcat") }}
alias cat=bat
{{- end }}
{{- if lookPath "lsd" }}
alias ls=lsd
{{- end }}
# Universal aliases
alias config='git --git-dir=$HOME/.cfg/ --work-tree=$HOME'