commit 11724dcbbd2f4e301761393ef4760419b017c0fb
parent 4d26529c9f301edfda81fc58f39b96c63e4dc566
Author: Adham Zahran <lordadamson@gmail.com>
Date: Wed, 13 Sep 2017 13:34:01 +0200
parent 4d26529c9f301edfda81fc58f39b96c63e4dc566
Author: Adham Zahran <lordadamson@gmail.com>
Date: Wed, 13 Sep 2017 13:34:01 +0200
it outputs absolutely nothing if there are no repos
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/git-summary b/git-summary @@ -56,6 +56,10 @@ git_summary() { # Use provided path, or default to pwd local target=$(readlink -f ${1:-`pwd`}) local repos=$(list_repos $target) + + if [[ -z $repos ]]; then + exit + fi # We compute the repo names and branch names here so we can # compute their maximum lengths and lay things out nicely. This @@ -144,6 +148,7 @@ repo_branch () { # Given a path to a folder containing some git repos, compute the # names of the folders which actually do contain git repos. list_repos () { + # https://stackoverflow.com/questions/23356779/how-can-i-store-find-command-result-as-arrays-in-bash git_directories=() while IFS= read -r -d $'\0'; do git_directories+=("$REPLY")
: nply/git-summary