Skip to content

Commit 278d55f

Browse files
committed
bash_unit -v will display bash_unit current version.
Version information is extracted from VERSION variable wich is set at git checkout time with :
1 parent 7b00501 commit 278d55f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bash_unit filter=insert_tag

bash_unit

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#
1717
# https://github.com/pgrange/bash_unit
1818

19+
VERSION=snapshot
20+
1921
ESCAPE=$(printf "\033")
2022
NOCOLOR="${ESCAPE}[0m"
2123
RED="${ESCAPE}[91m"
@@ -152,10 +154,11 @@ run_test() {
152154

153155
usage() {
154156
echo "$1" >&2
155-
echo "$0 [-f <output format<] [-p <pattern1>] [-p <pattern2>]... <test_file1> <test_file2>..." >&2
157+
echo "$0 [-f <output format>] [-p <pattern1>] [-p <pattern2>]... <test_file1> <test_file2>..." >&2
156158
echo >&2
157159
echo "Runs tests in test files that match <pattern>s" >&2
158160
echo "<output format> is optionnal only supported value is tap" >&2
161+
echo "-v to get current version information" >&2
159162
echo "See https://github.com/pgrange/bash_unit" >&2
160163
exit 1
161164
}
@@ -263,7 +266,7 @@ tap_format() {
263266
output_format=text
264267
test_pattern=""
265268
separator=""
266-
while getopts "p:f:" option
269+
while getopts "vp:f:" option
267270
do
268271
case "$option" in
269272
p)
@@ -273,6 +276,10 @@ do
273276
f)
274277
output_format="${OPTARG}"
275278
;;
279+
v)
280+
echo "bash_unit $VERSION"
281+
exit
282+
;;
276283
?|:)
277284
usage
278285
;;

0 commit comments

Comments
 (0)