Skip to contentSkip to conversation

Improvements for cg and cg-help

PATCH In review Pavel Roskin 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Improvements for cg and cg-help

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]
...
cg +4 -1
@@ -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 "$@"
cg-help +3 -1
@@ -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
 
 
Signature · 2 lines
Regards,
Pavel Roskin
#1 lore raw

Dear diary, on Thu, Jun 09, 2005 at 05:17:22PM CEST, I got a letter where Pavel Roskin <[email protected]> told me that...

Quoted 1 line

Hello!

Hello,

Quoted 2 lines

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

it shouldn't.

Quoted 1 line

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.

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