git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [COGITO PATCH] Improvements for cg and cg-help
@ 2005-06-09 15:17 Pavel Roskin
  2005-06-10 22:36 ` Petr Baudis
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Roskin @ 2005-06-09 15:17 UTC (permalink / raw)
  To: git

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [COGITO PATCH] Improvements for cg and cg-help
  2005-06-09 15:17 [COGITO PATCH] Improvements for cg and cg-help Pavel Roskin
@ 2005-06-10 22:36 ` Petr Baudis
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Baudis @ 2005-06-10 22:36 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: git

Dear diary, on Thu, Jun 09, 2005 at 05:17:22PM CEST, I got a letter
where Pavel Roskin <proski@gnu.org> told me that...
> Hello!

Hello,

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

it shouldn't.

> cg-help should print help for cg-help if specific help is not available,

it shouldn't, it should report an error.

The rest was applied, thanks.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
<Espy> be careful, some twit might quote you out of context..

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-06-10 22:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-09 15:17 [COGITO PATCH] Improvements for cg and cg-help Pavel Roskin
2005-06-10 22:36 ` Petr Baudis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).