* [PATCH] Allow command abbreviation
@ 2007-02-26 16:32 Yasushi SHOJI
2007-02-26 17:13 ` Josef Sipek
0 siblings, 1 reply; 2+ messages in thread
From: Yasushi SHOJI @ 2007-02-26 16:32 UTC (permalink / raw)
To: Josef 'Jeff' Sipek; +Cc: git
quilt allow us to type
quilt ser
instead of
quilt series
this patch does the same thing.
---
guilt | 39 ++++++++++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/guilt b/guilt
index f5a55ff..8072509 100755
--- a/guilt
+++ b/guilt
@@ -6,29 +6,54 @@
GUILT_VERSION="0.20"
GUILT_NAME="Buddy Holly"
+function guilt_commands
+{
+ local command
+ for command in $0-*
+ do
+ if [ -f "$command" -a -x "$command" ]
+ then
+ echo ${command##$0-}
+ fi
+ done
+}
+
if [ `basename $0` = "guilt" ]; then
# being run as standalone
# by default, we shouldn't fail
- fail=0
+ cmd=
if [ $# -ne 0 ]; then
# take first arg, and try to execute it
- cmd="$1"
+ arg="$1"
dir=`dirname $0`
- if [ ! -x "$dir/guilt-$cmd" ]; then
- echo "Command $cmd not found" >&2
- echo "" >&2
- fail=1
+ if [ -x "$dir/guilt-$arg" ]; then
+ cmd=$arg
else
+ # might be a short handed
+ for command in $(guilt_commands); do
+ case $command in
+ $arg*)
+ if [ -x "$dir/guilt-$command" ]; then
+ cmd=$command
+ fi
+ ;;
+ esac
+ done
+ fi
+ if [ $cmd ]; then
shift
exec "$dir/guilt-$cmd" "$@"
# this is not reached because of the exec
echo "Exec failed! Something is terribly wrong!" >&2
exit 1
+ else
+ echo "Command $arg not found" >&2
+ echo "" >&2
fi
fi
@@ -48,7 +73,7 @@ if [ `basename $0` = "guilt" ]; then
echo -e "\tguilt push"
# now, let's exit
- exit $fail
+ exit 1
fi
########
--
1.5.0.1.236.g6c09
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Allow command abbreviation
2007-02-26 16:32 [PATCH] Allow command abbreviation Yasushi SHOJI
@ 2007-02-26 17:13 ` Josef Sipek
0 siblings, 0 replies; 2+ messages in thread
From: Josef Sipek @ 2007-02-26 17:13 UTC (permalink / raw)
To: Yasushi SHOJI; +Cc: git
On Tue, Feb 27, 2007 at 01:32:16AM +0900, Yasushi SHOJI wrote:
> quilt allow us to type
>
> quilt ser
>
> instead of
>
> quilt series
>
> this patch does the same thing.
Applied.
Thanks.
Josef "Jeff" Sipek.
--
Defenestration n. (formal or joc.):
The act of removing Windows from your computer in disgust, usually
followed by the installation of Linux or some other Unix-like operating
system.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-26 17:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 16:32 [PATCH] Allow command abbreviation Yasushi SHOJI
2007-02-26 17:13 ` Josef Sipek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.