Commit b861a5ce authored by Bruno Pinto's avatar Bruno Pinto

deprecating _append_path and create _prepend_path

parent 73459aeb
# Appends the path to the specified path list. If no list specified, # Appends the path to the specified path list. If no list specified,
# defaults to $PATH # defaults to $PATH
function _append_path function _append_path
set_color red
echo '_append_path function deprecated. Rename to _prepend_path.'
set_color normal
set -l path PATH set -l path PATH
if test (echo $argv | wc -w) -eq 2 if test (echo $argv | wc -w) -eq 2
......
# Prepends the path to the specified path list. If no list specified, defaults to $PATH
function _prepend_path
set -l path PATH
if test (echo $argv | wc -w) -eq 2
set path $argv[2]
end
if test -d $argv[1]
if not contains $argv[1] $$path
set $path $argv[1] $$path
end
end
end
...@@ -6,16 +6,16 @@ function _fish_add_plugin ...@@ -6,16 +6,16 @@ function _fish_add_plugin
set -l plugin $argv[1] set -l plugin $argv[1]
set -l plugin_path "plugins/$plugin" set -l plugin_path "plugins/$plugin"
_append_path $fish_path/$plugin_path fish_function_path _prepend_path $fish_path/$plugin_path fish_function_path
_append_path $fish_custom/$plugin_path fish_function_path _prepend_path $fish_custom/$plugin_path fish_function_path
end end
function _fish_add_completion function _fish_add_completion
set -l plugin $argv[1] set -l plugin $argv[1]
set -l completion_path "plugins/$plugin/completions" set -l completion_path "plugins/$plugin/completions"
_append_path $fish_path/$completion_path fish_complete_path _prepend_path $fish_path/$completion_path fish_complete_path
_append_path $fish_custom/$completion_path fish_complete_path _prepend_path $fish_custom/$completion_path fish_complete_path
end end
function _fish_source_plugin_load_file function _fish_source_plugin_load_file
...@@ -32,8 +32,8 @@ function _fish_source_plugin_load_file ...@@ -32,8 +32,8 @@ function _fish_source_plugin_load_file
end end
function _fish_load_theme function _fish_load_theme
_append_path $fish_path/themes/$fish_theme fish_function_path _prepend_path $fish_path/themes/$fish_theme fish_function_path
_append_path $fish_custom/themes/$fish_theme fish_function_path _prepend_path $fish_custom/themes/$fish_theme fish_function_path
end end
### ###
......
if test -n "$ANDROID_SDK_ROOT" if test -n "$ANDROID_SDK_ROOT"
_append_path $ANDROID_SDK_ROOT/tools _prepend_path $ANDROID_SDK_ROOT/tools
_append_path $ANDROID_SDK_ROOT/platform-tools _prepend_path $ANDROID_SDK_ROOT/platform-tools
else else
_append_path /opt/android-sdk/tools _prepend_path /opt/android-sdk/tools
_append_path /opt/android-sdk/platform-tools _prepend_path /opt/android-sdk/platform-tools
end end
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
set -gx USE_CCACHE 1 set -gx USE_CCACHE 1
if test -n "$CCACHE_ROOT" if test -n "$CCACHE_ROOT"
_append_path $CCACHE_ROOT _prepend_path $CCACHE_ROOT
else else
_append_path /usr/lib/ccache/bin _prepend_path /usr/lib/ccache/bin
end end
if test -n "$GEM_ROOT" if test -n "$GEM_ROOT"
set -gx GEM_HOME $GEM_ROOT set -gx GEM_HOME $GEM_ROOT
_append_path $GEM_ROOT/bin _prepend_path $GEM_ROOT/bin
end end
for gvm_path in (find $HOME/.gvm/*/current/bin -maxdepth 0) for gvm_path in (find $HOME/.gvm/*/current/bin -maxdepth 0)
_append_path $gvm_path _prepend_path $gvm_path
end end
\ No newline at end of file
if test -n "$NDENV_ROOT" if test -n "$NDENV_ROOT"
_append_path $NDENV_ROOT/bin _prepend_path $NDENV_ROOT/bin
_append_path $NDENV_ROOT/shims _prepend_path $NDENV_ROOT/shims
else else
_append_path $HOME/.ndenv/bin _prepend_path $HOME/.ndenv/bin
_append_path $HOME/.ndenv/shims _prepend_path $HOME/.ndenv/shims
end end
### Main program ### Main program
_append_path /usr/local/share/npm/bin _prepend_path /usr/local/share/npm/bin
set PATH ./node_modules/.bin $PATH set PATH ./node_modules/.bin $PATH
if test -n "$NODENV_ROOT" if test -n "$NODENV_ROOT"
_append_path $NODENV_ROOT/bin _prepend_path $NODENV_ROOT/bin
else else
_append_path $HOME/.nodenv/bin _prepend_path $HOME/.nodenv/bin
end end
status --is-interactive; and source (nodenv init - | psub) status --is-interactive; and source (nodenv init - | psub)
_append_path $HOME/.plenv/bin _prepend_path $HOME/.plenv/bin
_append_path $HOME/.plenv/shims _prepend_path $HOME/.plenv/shims
if test -n "$PYENV_ROOT" if test -n "$PYENV_ROOT"
_append_path $PYENV_ROOT/bin _prepend_path $PYENV_ROOT/bin
_append_path $PYENV_ROOT/shims _prepend_path $PYENV_ROOT/shims
else else
_append_path $HOME/.pyenv/bin _prepend_path $HOME/.pyenv/bin
_append_path $HOME/.pyenv/shims _prepend_path $HOME/.pyenv/shims
end end
if test -n "$RBENV_ROOT" if test -n "$RBENV_ROOT"
_append_path $RBENV_ROOT/bin _prepend_path $RBENV_ROOT/bin
_append_path $RBENV_ROOT/shims _prepend_path $RBENV_ROOT/shims
else else
_append_path $HOME/.rbenv/bin _prepend_path $HOME/.rbenv/bin
_append_path $HOME/.rbenv/shims _prepend_path $HOME/.rbenv/shims
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment