zsh:alias:add_flags: Keep existing aliases

Instead of overwriting existing aliases, reuse them.
This makes it possible to add multiple flags in multiple calls to
`add_flags` for example when a flag should only be added on certain
systems, etc..
This commit is contained in:
2021-07-23 12:57:03 +02:00
parent 6ba872c9c7
commit acf1f6b691

View File

@@ -10,7 +10,7 @@
add_flags() {
(( $# >= 2 )) || (( $+commands[$1])) || return 0
alias "$1"="$*"
alias "$1"="${aliases[$1]:-$1} ${*[2,-1]}"
}
# Default flags