From 042657cdcf9707b83ce30ebc3baff5e780614925 Mon Sep 17 00:00:00 2001 From: Derek Stavis Date: Sun, 1 Nov 2015 22:03:56 -0200 Subject: [PATCH] require: recursively require package dependencies --- lib/require.fish | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/require.fish b/lib/require.fish index 497267c..db7c959 100644 --- a/lib/require.fish +++ b/lib/require.fish @@ -4,6 +4,7 @@ # OVERVIEW # Require a plugin: # - Autoload its functions and completions. +# - Require bundle dependencies. # - Source its initialization file. # - Emit its initialization event. # @@ -16,8 +17,18 @@ function require -a name and return 0 for path in {$OMF_PATH,$OMF_CONFIG}/pkg/$name + test -d $path; or continue + if autoload $path $path/functions $path/completions + if test -f $path/bundle + for line in (cat $path/bundle) + test (echo $line | cut -d' ' -f1) = package; + and set dependency (basename (echo $line | cut -d' ' -f2)); + and require $dependency + end + end + source $path/init.fish ^/dev/null; or source $path/$name.fish ^/dev/null; and emit init_$name $path