git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[COGITO PATCH] Improvements for cg and cg-help

From
PRPavel Roskin <proski@gnu.org>
Date
Jun 9, 2005, 15:17 UTC
Message-ID
<1118330242.27441.15.camel@dv>
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
Next: Petr Baudis
Message 1 of 2 in “Improvements for cg and cg-help”
  1. Improvements for cg and cg-helpPavel Roskin, Jun 9, 2005
  2. Petr BaudisJun 10, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.