From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yasushi SHOJI Subject: [PATCH] Allow command abbreviation Date: Tue, 27 Feb 2007 01:32:16 +0900 Message-ID: <87mz30khax.wl@mail2.atmark-techno.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: git@vger.kernel.org To: Josef 'Jeff' Sipek X-From: git-owner@vger.kernel.org Mon Feb 26 17:36:34 2007 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1HLiq0-0007Sh-HL for gcvg-git@gmane.org; Mon, 26 Feb 2007 17:36:32 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030312AbXBZQf5 (ORCPT ); Mon, 26 Feb 2007 11:35:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752443AbXBZQf5 (ORCPT ); Mon, 26 Feb 2007 11:35:57 -0500 Received: from mail2.atmark-techno.com ([210.191.215.173]:37740 "EHLO mail2.atmark-techno.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752457AbXBZQfz (ORCPT ); Mon, 26 Feb 2007 11:35:55 -0500 Received: from wat.atmark-techno.com.atmark-techno.com (dns1.atmark-techno.com [210.191.215.170]) by mail2.atmark-techno.com (Postfix) with ESMTP id 5A77A29DDD; Tue, 27 Feb 2007 01:35:50 +0900 (JST) User-Agent: Wanderlust/2.14.0 Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: 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