-
Notifications
You must be signed in to change notification settings - Fork 0
/
cg-version.in
45 lines (40 loc) · 960 Bytes
/
cg-version.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
#
# Show the version of the Cogito toolkit
# Copyright (c) Petr Baudis, 2005
#
# Show which version of Cogito is installed.
# Additionally, the 'HEAD' of the installed Cogito
# is also shown if this information was available
# at the build time.
#
# OPTIONS
# -------
# --lib-dir:: Display Cogito library directory
# Display the directory containing Cogito library files.
#
# --share-dir:: Display Cogito share directory
# Display the directory containing Cogito shared files.
# Testsuite: TODO
USAGE="cg-version [--lib-dir] [--share-dir]"
_git_repo_unneeded=1
. "${COGITO_LIB}"cg-Xlib || exit 1
while optparse; do
if optparse --lib-dir; then
echo "${COGITO_LIB}"
elif optparse --share-dir; then
echo "${COGITO_SHARE}"
else
optfail
fi
done
version="@@VERSION@@"
head="@@GIT_HEAD_ID@@"
if [ -z "$head" ]; then
echo "$version"
exit
elif [ "$version" = "$head" ]; then
echo "$version (real)"
else
echo "$version ($head)"
fi