Merge branch 'prepend_path'

This commit is contained in:
Bruno Pinto 2014-11-29 17:17:28 +11:00
commit 3a4b7de689
13 changed files with 50 additions and 32 deletions

View File

@ -1,6 +1,10 @@
# 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

View File

@ -0,0 +1,14 @@
# 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

View File

@ -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
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
### ###

View File

@ -1,7 +1,7 @@
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

View File

@ -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

View File

@ -1,4 +1,4 @@
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

View File

@ -1,3 +1,3 @@
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

View File

@ -1,7 +1,7 @@
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

View File

@ -1,4 +1,4 @@
### 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

View File

@ -1,7 +1,7 @@
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)

View File

@ -1,2 +1,2 @@
_append_path $HOME/.plenv/bin _prepend_path $HOME/.plenv/bin
_append_path $HOME/.plenv/shims _prepend_path $HOME/.plenv/shims

View File

@ -1,7 +1,7 @@
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

View File

@ -1,7 +1,7 @@
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