Move PATH API to its own module
This commit is contained in:
parent
907ee8e6c9
commit
f892f5d605
20
.bashrc
20
.bashrc
|
@ -42,26 +42,6 @@ __dotlib_set_SHOPTS
|
|||
|
||||
ulimit -c unlimited
|
||||
|
||||
###
|
||||
# Search Path Manager
|
||||
###
|
||||
|
||||
add-path() {
|
||||
local path paths path_list=( )
|
||||
declare -A uniq_paths
|
||||
IFS=: read -ra paths <<< "$PATH"
|
||||
|
||||
for path in "$@" "${paths[@]}"; do
|
||||
if [[ ! -v uniq_paths[$path] ]]; then
|
||||
uniq_paths[$path]=42
|
||||
path_list+=("$path")
|
||||
fi
|
||||
done
|
||||
|
||||
printf -v path %s: "${path_list[@]}"
|
||||
export PATH=${path%:}
|
||||
}
|
||||
|
||||
###
|
||||
# Library loader
|
||||
###
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
add-path() {
|
||||
local path paths path_list=( )
|
||||
declare -A uniq_paths
|
||||
IFS=: read -ra paths <<< "$PATH"
|
||||
|
||||
for path in "$@" "${paths[@]}"; do
|
||||
if [[ ! -v uniq_paths[$path] ]]; then
|
||||
uniq_paths[$path]=42
|
||||
path_list+=("$path")
|
||||
fi
|
||||
done
|
||||
|
||||
printf -v path %s: "${path_list[@]}"
|
||||
export PATH=${path%:}
|
||||
}
|
Loading…
Reference in New Issue