From a1927ee61bb9efe3d8246b8569e98a79665b5492 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Tue, 19 Sep 2023 11:06:17 +0200 Subject: [PATCH] add GIS_PATH variable --- gis | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gis b/gis index 0db7cf5..97a2803 100755 --- a/gis +++ b/gis @@ -12,7 +12,8 @@ function print_usage { Usage: gis [OPTIONS] [PATHS] ... Get status information about all Git repositories in PATHS. -The current work directory is used if none is given. +The colon-seperated environment variable \$GIS_PATH is used if no PATH is given. +If the variable isn't set, the current work directory is used. OPTIONS -f, --fetch Execute 'git fetch --prune --all' for all repositories in PATHS @@ -43,8 +44,12 @@ while (( "$#" )); do esac done -# Add current work directory to paths if none is given -if [ "${paths[*]}" == "" ]; then +# Add $GIS_PATH or current work directory to paths if none is given +if [ "$GIS_PATH" ]; then + OLDIFS=$IFS + IFS=":" read -r -a paths <<< "$GIS_PATH" + IFS=$OLDIFS +elif [ "${paths[*]}" == "" ]; then paths=("$(pwd)") fi