Allow 'guilt foo' commands
[guilt.git] / guilt
blobd3413cc3ac80aef5388619202f4bafa859ae8d35
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 if [ `basename $0` = "guilt" ]; then
7 # being run as standalone
9 # by default, we shouldn't fail
10 fail=0
12 if [ $# -ne 0 ]; then
13 # take first arg, and try to execute it
15 cmd="$1"
16 dir=`dirname $0`
18 if [ ! -x "$dir/guilt-$cmd" ]; then
19 echo "Command $cmd not found" >&2
20 echo "" >&2
21 fail=1
22 else
23 shift
24 exec "$dir/guilt-$cmd" "$@"
26 # this is not reached because of the exec
27 echo "Exec failed! Something is terribly wrong!" >&2
28 exit 1
32 # no args passed or invalid command entered, just output help summary
34 echo "Pick a command:"
35 for x in `dirname $0`/guilt-*; do
36 [ -x $x ] && echo -e "\t`basename $x`"
37 done
39 echo ""
40 echo "Example:"
41 echo -e "\tguilt-push"
42 echo "or"
43 echo -e "\tguilt push"
45 # now, let's exit
46 exit $fail