@@ -44,6 +44,9 @@ DESCRIPTION
4444
4545 -f Forces a re-evaluation of the entire git history.
4646
47+ -p Increments PATCH version on _every_ run.
48+ WARN: This is intended development use only.
49+
4750EXAMPLES
4851 The following detects the new version for the repo.
4952
@@ -64,15 +67,15 @@ printHelp() {
6467# --------------------------------------------------------------------------------------------------
6568
6669if ! git rev-parse --git-dir > /dev/null 2>&1 ; then
67- echo -e " \e[01;31mFATAL\e[00m: This is not a git repository!\n"
70+ echo -e " \e[01;31mFATAL\e[00m: 590 - This is not a git repository!\n"
6871fi
6972
7073# --------------------------------------------------------------------------------------------------
7174# Arguments
7275# --------------------------------------------------------------------------------------------------
7376
7477OPTIND=1
75- while getopts " he:vf " opt; do
78+ while getopts " he:vfp " opt; do
7679 case $opt in
7780 h)
7881 printHelp
@@ -89,8 +92,11 @@ while getopts "he:vf" opt; do
8992 f)
9093 arg_f=' set'
9194 ;;
95+ p)
96+ arg_p=' set'
97+ ;;
9298 * )
93- echo -e " \e[01;31mERROR\e[00m: Invalid argument!"
99+ echo -e " \e[01;31mERROR\e[00m: 570 - Invalid argument!"
94100 printHelp
95101 if [[ " $sourced " == 0 ]]; then
96102 exit 0
@@ -147,7 +153,7 @@ case "$origin_host" in
147153 field=1
148154 ;;
149155 * )
150- echo -e " \e[01;31mERROR\e[0m: Unsupported origin host."
156+ echo -e " \e[01;31mERROR\e[0m: 591 - Unsupported origin host."
151157 exit 1
152158 ;;
153159esac
@@ -198,7 +204,7 @@ if [[ -n $arg_f ]]; then
198204 true
199205else
200206 if [[ -z $incrementMajor && -z $count_feature && -z $count_enhancement && -z $count_fix && -z $count_bugfix && -z $count_hotfix && -z $count_ops ]]; then
201- echo -e " \e[01;31mERROR\e[00m: No feature, enhancement, fix, bugfix, hotfix, or ops branches detected!"
207+ echo -e " \e[01;31mERROR\e[00m: 599 - No feature, enhancement, fix, bugfix, hotfix, or ops branches detected!"
202208 exit 1 # For GH Actions
203209 if [[ " $sourced " == 0 ]]; then
204210 exit 1
@@ -228,6 +234,10 @@ elif [[ -n $count_fix || -n $count_bugfix || -n $count_hotfix || -n $count_ops ]
228234 [[ -n $count_bugfix ]] && newVersionPatch=$(( newVersionPatch + count_bugfix))
229235 [[ -n $count_hotfix ]] && newVersionPatch=$(( newVersionPatch + count_hotfix))
230236 [[ -n $count_ops ]] && newVersionPatch=$(( newVersionPatch + count_ops))
237+ elif [[ -n $arg_p && -z $incrementMajor && -z $count_feature && -z $count_enhancement && -z $count_fix && -z $count_bugfix && -z $count_hotfix && -z $count_ops ]]; then
238+ newVersionMajor=$lastVersionMajor
239+ newVersionMinor=$lastVersionMinor
240+ newVersionPatch=$(( lastVersionPatch + 1 ))
231241fi
232242
233243newVersion=$( /usr/bin/env bash -c " ${dir} /validateSemver.sh -9p full $newVersionMajor .$newVersionMinor .$newVersionPatch " )
@@ -238,4 +248,4 @@ if [[ -n $arg_e ]]; then
238248 export export_var
239249else
240250 echo " $newVersion "
241- fi
251+ fi
0 commit comments