Skip to content

Commit 3fea699

Browse files
committed
Update build-aux/version to operate on the full version
Works better with my devtools to automatically commit version changes.
1 parent 31501ad commit 3fea699

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

‎build-aux/version‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
#
55
# SPDX-License-Identifier: GPL-3.0-or-later
66

7-
major=2
8-
minor=5
9-
patch=0
10-
11-
version=$major.$minor.$patch
7+
version=2.5.0
128

139
read -rd '' help <<EOF
1410
Usage: $0 [OPTIONS...]
@@ -43,19 +39,20 @@ do
4339
key=$1
4440
case $key in
4541
-s|--short)
46-
version=$major.$minor
42+
result=${version%.*}
4743
shift
4844
;;
4945
-M|--major)
50-
version=$major
46+
result=${version%%.*}
5147
shift
5248
;;
5349
-m|--minor)
54-
version=$minor
50+
short=${version%.*}
51+
result=${short#*.}
5552
shift
5653
;;
5754
-p|--patch)
58-
version=$patch
55+
result=${version##*.}
5956
shift
6057
;;
6158
-h|--help)
@@ -69,4 +66,4 @@ case $key in
6966
esac
7067
done
7168

72-
echo $version
69+
echo "${result:-$version}"

0 commit comments

Comments
 (0)