From 85bbcccd27ff9884acfb53b94b3b3048ca1a6954 Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Thu, 4 Feb 2016 13:52:43 +0900 Subject: [PATCH] Display deps as they install along with parent plugin. --- functions/__fisher_deps_install.fish | 16 +++++----------- test/deps-install.fish | 16 ++++------------ 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/functions/__fisher_deps_install.fish b/functions/__fisher_deps_install.fish index 532978a..65f2cce 100644 --- a/functions/__fisher_deps_install.fish +++ b/functions/__fisher_deps_install.fish @@ -1,13 +1,7 @@ function __fisher_deps_install -a path - printf 0 - - if test -s $path/bundle -o -s $path/fishfile - printf "Installing dependencies >> (%s)\n" ( - for file in $path/{bundle,fishfile} - __fisher_list $file - end | paste -sd ' ' - - ) > /dev/stderr - - cat $path/{bundle,fishfile} | fisher_install ^| sed -En 's/([0-9]+) plugin\/s.*/\1/p' - end + for file in $path/{fishfile,bundle} + if test -s $file + fisher_install < $file | sed -En 's/^.+([0-9]+) plugin\/s.*/\1/p' + end + end | awk '{ n = n + $0 } END { print n ? n : 0 }' end diff --git a/test/deps-install.fish b/test/deps-install.fish index 633a991..605ce36 100644 --- a/test/deps-install.fish +++ b/test/deps-install.fish @@ -8,16 +8,12 @@ function -S setup function fisher_install set -l count 0 + while read -l plugin - - # Fisherman CLI text message are usually written to /dev/stderr, - # so we must write to /dev/stderr too. - - echo $plugin > /dev/stderr set count (math $count + 1) end - echo "$count plugin/s" > /dev/stderr + echo "Aye! $count plugin/s installed." end end @@ -26,14 +22,10 @@ function -S teardown functions -e fisher_install end -test "$TESTNAME - List dependencies to be installed" - (__fisher_deps_install $path > /dev/null ^| sed -E 's/.*>> (.*)/\1/') = "(foo bar baz norf)" -end - test "$TESTNAME - Install dependencies from one or more bundle/fishfile files" - (__fisher_deps_install $path ^ /dev/null) = 04 + (__fisher_deps_install $path ^ /dev/null) = 4 end -test "$TESTNAME - Fail to indicate no dependencies were installed" +test "$TESTNAME - Print 0 to indicate no dependencies were installed" (__fisher_deps_install $path/void) = 0 end