blob: c8d52a9591f58b5eb46f2ea4468627c82b8a2682 (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#! /bin/sh
# Copyright (C) 2009-2010 Uwe Kleine-König
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
set -e
UG_VERSION="20100908.0"
export UG_VERSION
if test "${UG_EXEC_PATH:+set}" != "set"; then
UG_EXEC_PATH='@@UG_EXEC_PATH@@'
export UG_EXEC_PATH
fi
UG_OPTIONS_SPEC="\
ug --version
ug [-h|--help]
ug [--debug] <command> ...
--
debug print much unreadable and unusable output
h,help! show this help
version! show version number and exit
"
. "$UG_EXEC_PATH/uglib.sh"
## help ## {{{1
help() {
echo "Use the source, Luke"
}
## version ## {{{1
version() {
echo "$UG_VERSION"
}
# }}}
while true; do
case "$1" in
--help)
# This isn't reached as
# git rev-parse --parseopt catches -h,--help
help
exit 0
;;
--version)
version
exit 0
;;
--debug)
shopt="-x"
;;
--)
break
;;
esac
shift
done
GIT_DIR="$(git rev-parse --git-dir)"
export GIT_DIR
assert test "x$1" = "x--"
shift
ug_cmd="$1"; shift
case "$ug_cmd" in
"")
help
exit 1
;;
help)
help
;;
version)
version
;;
*)
if test -x "$UG_EXEC_PATH/ug-$ug_cmd"; then
exec sh $shopt "$UG_EXEC_PATH/ug-$ug_cmd" "$@"
else
die "Unknown command: $ug_cmd"
fi;;
esac
|