Add --stdout param to git_version_gen.sh

This causes git_version_gen.sh to print to stdout.
This commit is contained in:
ridiculousfish 2019-01-27 18:32:37 -08:00
parent c869ab541d
commit 0f5dc0b4e2

View File

@ -8,10 +8,6 @@ set -e
# Find the fish git directory as two levels up from script directory.
GIT_DIR="$( cd "$( dirname $( dirname "$0" ) )" && pwd )"
# Set the output directory as either the first param or cwd.
test -n "$1" && OUTPUT_DIR=$1/ || OUTPUT_DIR=
FBVF=${OUTPUT_DIR}FISH-BUILD-VERSION-FILE
DEF_VER=unknown
# First see if there is a version file (included in release tarballs),
@ -23,6 +19,17 @@ elif ! VN=$(git -C "$GIT_DIR" describe --always --dirty 2>/dev/null); then
VN="$DEF_VER"
fi
# If the first param is --stdout, then output to stdout and exit.
if test "$1" = '--stdout'
then
echo $VN
exit 0
fi
# Set the output directory as either the first param or cwd.
test -n "$1" && OUTPUT_DIR=$1/ || OUTPUT_DIR=
FBVF=${OUTPUT_DIR}FISH-BUILD-VERSION-FILE
if test -r $FBVF
then
VC=$(grep -v '^#' $FBVF | tr -d '"' | sed -e 's/^FISH_BUILD_VERSION=//')