-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcg
executable file
·48 lines (43 loc) · 1.04 KB
/
cg
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
#!/usr/bin/env bash
#
# Wrapper for running Cogito commands.
# Copyright (c) Petr Baudis, 2005
#
# Takes a variable number of arguments where the first argument should
# either be a Cogito command or one of the supported options. If no
# arguments are specified an overview of all the Cogito commands will be
# shown.
#
# Enables all Cogito commands to be accessed as subcommands, for example
# is:
#
# cg help
# cg-help
#
# equivalent.
#
# OPTIONS
# -------
# --version:: Show the Cogito toolkit version
# Show the version of the Cogito toolkit. Equivalent to the output
# of `cg-version`.
USAGE="cg [--version | COMMAND [ARGS]...]"
cmd="$1"; shift
case "$cmd" in
-h|--help|"") cmd="help" ;;
--version) cmd="version" ;;
-*)
echo "cg: unknown option '$cmd' (try 'cg --help' or 'cg --version')" >&2
exit 1
esac
exe="cg-$cmd"
# Cut'n'pasted from cg-Xlib
save_IFS="$IFS"; IFS=:
for dir in $PATH; do
IFS="$save_IFS"
exefile="$dir/$exe"
[ -x "$exefile" ] && exec "$exefile" "$@"
done
IFS="$save_IFS"
echo "cg: unknown command '$cmd' (try 'cg help')" >&2
exit 1