From 912315ba692661659a479546eb0dfbda74c9deec Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Wed, 14 Jan 2015 02:50:08 +0900 Subject: [PATCH 1/2] Do not add test/spec files to function path in _prepend_tree. --- functions/_prepend_tree.fish | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/_prepend_tree.fish b/functions/_prepend_tree.fish index fc6d177..7bf1e69 100644 --- a/functions/_prepend_tree.fish +++ b/functions/_prepend_tree.fish @@ -102,6 +102,11 @@ function _prepend_tree -d "Add a dependency tree to the Fish path." printf "%s\n" $dir end + # Do not add test/spec files to function path. + if contains -- (basename $dir) "test" "tests" "spec" + continue + end + # Prepend matched directory to the the global fish function path. # Note path duplicates are already handled by _prepend_path. _prepend_path $dir -d fish_function_path From 487557676111adf2820fc3e6dc56ba1209954591 Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Wed, 14 Jan 2015 03:10:51 +0900 Subject: [PATCH 2/2] Do not add test/spec files to function path via skip glob in `import`. --- functions/_prepend_tree.fish | 5 ----- functions/import.fish | 12 ++++++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/functions/_prepend_tree.fish b/functions/_prepend_tree.fish index 7bf1e69..fc6d177 100644 --- a/functions/_prepend_tree.fish +++ b/functions/_prepend_tree.fish @@ -102,11 +102,6 @@ function _prepend_tree -d "Add a dependency tree to the Fish path." printf "%s\n" $dir end - # Do not add test/spec files to function path. - if contains -- (basename $dir) "test" "tests" "spec" - continue - end - # Prepend matched directory to the the global fish function path. # Note path duplicates are already handled by _prepend_path. _prepend_path $dir -d fish_function_path diff --git a/functions/import.fish b/functions/import.fish index d8118f9..22f0853 100644 --- a/functions/import.fish +++ b/functions/import.fish @@ -12,7 +12,8 @@ # NOTES # $fish_path and $fish_custom point to oh-my-fish home and the user # dotfiles folder respectively. Both globals are usually configured -# in ~/.config/fish/config.fish +# in ~/.config/fish/config.fish. Also, import is clever enough to +# skip directories with *.spec.fish files. # # EXAMPLES # import plugins/ @@ -25,14 +26,17 @@ # functions/_prepend_path.fish # functions/_prepend_tree.fish # -# v.0.1.0 +# v.0.1.1 #/ function import -d "Load libraries, plugins, themes, etc." + # Do not add spec files to function path. + set -l skip_spec \*.fish -a ! \*.spec.fish + for library in $argv # Prepend plugins, themes and completions, traversing library # trees and prepending directories with fish code. - _prepend_tree $fish_path/$library - _prepend_tree $fish_custom/$library + _prepend_tree $fish_path/$library $skip_spec + _prepend_tree $fish_custom/$library $skip_spec _prepend_path $fish_path/$library/completions -d fish_complete_path # Set path to load files.