bin/bump-version.sh in docman-0.0.96 vs bin/bump-version.sh in docman-0.0.97
- old
+ new
@@ -13,10 +13,11 @@
# a file called CHANGES (under the title of the new version
# number) and create a GIT tag.
POSITIONAL=()
BRANCH="master"
+TAG=""
NEXT=0
SKIP=0
if [[ $# == 0 ]]; then
POSITIONAL+=("-h")
@@ -34,10 +35,20 @@
else
BRANCH="${1#*=}"
shift # past argument=value
fi
;;
+ -t|--tag*)
+ if [[ $key == "-t" ]] || [[ $key == "--tag" ]]; then
+ TAG="$2"
+ shift # past argument
+ shift # past value
+ else
+ TAG="${1#*=}"
+ shift # past argument=value
+ fi
+ ;;
-n|--next)
NEXT=1
shift # past argument
;;
-s|--skip)
@@ -46,10 +57,11 @@
;;
-h|--help)
echo "Usage: -[hbns] [state] [next] [skip]"
echo -e "\t-h, --help\n\t\tShow this help message."
echo -e "\t-b [branch], --branch [branch], --branch=[branch]\n\t\tTag specific branch."
+ echo -e "\t-t [tag], --tag [tag], --tag=[tag]\n\t\tBump specific version."
echo -e "\t-n, --next\n\t\tSet next release without prompt."
echo -e "\t-s, --skip\n\t\tSkip CI trigger with commit message."
exit 0
;;
*) # unknown option
@@ -93,24 +105,28 @@
V_PATCH=$((V_PATCH + 1))
SUGGESTED_VERSION="${V_PREFIX}${V_MAJOR}.${V_MINOR}.${V_PATCH}${V_SUFFIX}"
fi
fi
- if [ -n "$SUGGESTED_VERSION" ]; then
- if [[ $NEXT == 1 ]]; then
- INPUT_STRING=$SUGGESTED_VERSION
+ if [[ $TAG == "" ]]; then
+ if [ -n "$SUGGESTED_VERSION" ]; then
+ if [[ $NEXT == 1 ]]; then
+ INPUT_STRING=$SUGGESTED_VERSION
+ else
+ read -p "Enter a version number [$SUGGESTED_VERSION]: " INPUT_STRING
+ if [ "$INPUT_STRING" = "" ]; then
+ INPUT_STRING=$SUGGESTED_VERSION
+ fi
+ fi
else
- read -p "Enter a version number [$SUGGESTED_VERSION]: " INPUT_STRING
+ read -p "Enter a version number: " INPUT_STRING
if [ "$INPUT_STRING" = "" ]; then
- INPUT_STRING=$SUGGESTED_VERSION
+ echo "Version number should not be empty to continue."
+ exit 1
fi
fi
else
- read -p "Enter a version number: " INPUT_STRING
- if [ "$INPUT_STRING" = "" ]; then
- echo "Version number should not be empty to continue."
- exit 1
- fi
+ INPUT_STRING=$TAG
fi
echo "Will set new version to be $INPUT_STRING"
echo $INPUT_STRING > VERSION
TAG=${INPUT_STRING}