All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: git <git@vger.kernel.org>
Subject: [COGITO PATCH] Improvements for cg and cg-help
Date: Thu, 09 Jun 2005 11:17:22 -0400	[thread overview]
Message-ID: <1118330242.27441.15.camel@dv> (raw)

Hello!

cg should not run cg-help with arguments unless they were specified
after an explicit "help" command
("cg help -option")

cg without arguments should run cg-help.
cg with any option before the command ("cg -foo cmd") should also run
cg-help.

cg-help should print help for cg-help if specific help is not available,
e.g.:

$ cg-help foo
Error: no help available for "foo"
Usage: cg-help [COMMAND]
...

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/cg b/cg
--- a/cg
+++ b/cg
@@ -1,7 +1,10 @@
 #!/bin/sh
 
 cmd="$1"; shift
-[ x"$cmd" = x"--help" ] && cmd="help"
+case x$cmd in
+	x-*) exec cg-help;;
+	x) exec cg-help;;
+esac
 
 exe="cg-$cmd"
 exec $exe "$@"
diff --git a/cg-help b/cg-help
--- a/cg-help
+++ b/cg-help
@@ -19,7 +19,9 @@ _git_repo_unneeded=1
 
 if [ "$1" ]; then
 	cmd=$(echo "$1" | sed 's/^cg-//')
-	print_help $cmd
+	(print_help $cmd) && exit
+	echo "Error: no help available for \"$1\""
+	print_help help
 fi
 
 


-- 
Regards,
Pavel Roskin


             reply	other threads:[~2005-06-09 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-09 15:17 Pavel Roskin [this message]
2005-06-10 22:36 ` [COGITO PATCH] Improvements for cg and cg-help Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118330242.27441.15.camel@dv \
    --to=proski@gnu.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.