mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-02-21 03:30:24 +08:00
Merge pull request #82 from theonewolf/fix-duplicating-function-path
This commit is contained in:
commit
1a6870b311
@ -2,15 +2,22 @@
|
||||
# Helper functions
|
||||
###
|
||||
|
||||
function _test_dir
|
||||
set -l path $argv[1]
|
||||
set -l paths $argv[2]
|
||||
|
||||
return (test -d $path; and not contains $path $paths)
|
||||
end
|
||||
|
||||
function _fish_add_plugin
|
||||
set -l plugin $argv[1]
|
||||
set -l plugin_path "plugins/$plugin"
|
||||
|
||||
if test -d $fish_path/$plugin_path
|
||||
if _test_dir $fish_path/$plugin_path $fish_function_path
|
||||
set fish_function_path $fish_path/$plugin_path $fish_function_path
|
||||
end
|
||||
|
||||
if test -d $fish_custom/$plugin_path
|
||||
if _test_dir $fish_custom/$plugin_path $fish_function_path
|
||||
set fish_function_path $fish_custom/$plugin_path $fish_function_path
|
||||
end
|
||||
end
|
||||
@ -42,11 +49,11 @@ function _fish_source_plugin_load_file
|
||||
end
|
||||
|
||||
function _fish_load_theme
|
||||
if test -d $fish_path/themes/$fish_theme
|
||||
if _test_dir $fish_path/themes/$fish_theme $fish_function_path
|
||||
set fish_function_path $fish_path/themes/$fish_theme $fish_function_path
|
||||
end
|
||||
|
||||
if test -d $fish_custom/themes/$fish_theme
|
||||
if _test_dir $fish_custom/themes/$fish_theme $fish_function_path
|
||||
set fish_function_path $fish_custom/themes/$fish_theme $fish_function_path
|
||||
end
|
||||
end
|
||||
@ -66,7 +73,9 @@ set user_function_path $fish_function_path[1]
|
||||
set -e fish_function_path[1]
|
||||
|
||||
# Add all functions
|
||||
set fish_function_path $fish_path/functions/ $fish_function_path
|
||||
if not contains $fish_path/functions/ $fish_function_path
|
||||
set fish_function_path $fish_path/functions/ $fish_function_path
|
||||
end
|
||||
|
||||
# Add all defined plugins
|
||||
for plugin in $fish_plugins
|
||||
|
Loading…
x
Reference in New Issue
Block a user