Skip to content

Commit

Permalink
qwe
Browse files Browse the repository at this point in the history
  • Loading branch information
deadtrickster committed Sep 9, 2017
1 parent 3436760 commit 90467d8
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions bin/increment-version
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
# Parse command line options.


while getopts ":Mmp" Option
while getopts ":Mmpa:" Option
do
case $Option in
M ) major=true;;
m ) minor=true;;
p ) patch=true;;
esac
case $Option in
M ) major=true;;
m ) minor=true;;
p ) patch=true;;
a ) alpha=${OPTARG};;
esac
done

shift $(($OPTIND - 1))
Expand Down Expand Up @@ -44,31 +45,36 @@ a=( ${version//./ } )

if [ ${#a[@]} -ne 3 ]
then
echo "usage: $(basename $0) [-Mmp] TAG_MESSAGE(optional)"
exit 1
echo "usage: $(basename $0) [-Mmp] TAG_MESSAGE(optional)"
exit 1
fi

# Increment version numbers as requested.

if [ ! -z $major ]
then
((a[0]++))
a[1]=0
a[2]=0
((a[0]++))
a[1]=0
a[2]=0
fi

if [ ! -z $minor ]
then
((a[1]++))
a[2]=0
((a[1]++))
a[2]=0
fi

if [ ! -z $patch ]
then
((a[2]++))
((a[2]++))
fi

new_version="${a[0]}.${a[1]}.${a[2]}"
if [ -z ${alpha+x} ];
then
new_version="${a[0]}.${a[1]}.${a[2]}";
else
new_version="${a[0]}.${a[1]}.${a[2]}.alpha-$alpha";
fi

echo "New version: ${new_version}"

Expand Down

0 comments on commit 90467d8

Please sign in to comment.