2022-08-13 13:26:55 -05:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
2022-11-28 14:32:03 -06:00
|
|
|
# TODO: Refactor this entire mess
|
|
|
|
|
2021-12-08 09:38:24 -06:00
|
|
|
# Start with system path
|
|
|
|
# Retrieve it from getconf, otherwise it's just current $PATH
|
2022-04-15 08:40:14 -05:00
|
|
|
prepend-path() {
|
2022-04-15 08:41:08 -05:00
|
|
|
[ -d $1 ] && PATH="$1:$PATH"
|
2022-04-15 08:40:14 -05:00
|
|
|
}
|
|
|
|
|
2022-11-11 22:03:11 -06:00
|
|
|
#is-executable getconf && PATH=$($(command -v getconf) PATH)
|
2021-12-08 09:38:24 -06:00
|
|
|
|
|
|
|
# Prepend new items to path (if directory exists)
|
2022-04-13 00:53:47 -05:00
|
|
|
prepend-path "/bin"
|
|
|
|
prepend-path "/usr/bin"
|
|
|
|
prepend-path "/usr/local/bin"
|
2022-08-26 11:33:17 -05:00
|
|
|
|
2021-12-08 09:38:24 -06:00
|
|
|
PATH="$DOTFILES_DIR/bin:$PATH"
|
|
|
|
PATH="$HOME/bin:$PATH"
|
|
|
|
PATH="$HOME/.local/bin:$PATH"
|
|
|
|
PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
PATH="$PATH:/usr/local/go/bin"
|
|
|
|
PATH="/usr/local/texlive/2021/bin/x86_64-linux:$PATH"
|
|
|
|
PATH="$HOME/go/bin:$PATH"
|
2022-11-28 14:32:03 -06:00
|
|
|
PATH="$HOME/.extra/bin:$PATH"
|
2021-12-08 09:38:24 -06:00
|
|
|
|
|
|
|
# Remove duplicates (preserving prepended items)
|
|
|
|
# Source: http://unix.stackexchange.com/a/40755
|
|
|
|
|
2022-04-13 00:53:47 -05:00
|
|
|
PATH=$(echo -n $PATH | awk -v RS=: '{ if (!arr[$0]++) {printf("%s%s",!ln++?"":":",$0)}}')
|
|
|
|
PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')"
|
2021-12-08 09:38:24 -06:00
|
|
|
|
2022-04-13 00:53:47 -05:00
|
|
|
# PATH=$(printf %s "$PATH" |
|
|
|
|
# awk -vRS=: -vORS= '!a[$0]++ {if (NR>1) printf(":"); printf("%s", $0) }')
|
|
|
|
# # Wrap up
|
2021-12-08 09:38:24 -06:00
|
|
|
|
|
|
|
export PATH
|