Subject: [PATCH Cogito] Copyright and document the cg script

From: Jonas Fonseca <[email-masked]>
Date: Sun, 2 Oct 2005 12:13:22 +0200

Some distributions require all programs to be documented with a manpage so
add a small script header and generate cg(1).

Signed-off-by: Jonas Fonseca <[email-masked]>

---
commit 9356837de630644323c800e2accad2618d7393f9
tree bdd4c673b6086cee5d5b51ecdb8e2968212afcac
parent 5e15803563ef00720541e89ae16a633ac8dfb7d7
author Jonas Fonseca <[email-masked]> Thu, 29 Sep 2005 15:13:02 +0200
committer Jonas Fonseca <[email-masked]> Thu, 29 Sep 2005 15:13:02 +0200

 Documentation/Makefile |   12 ++++++++----
 cg                     |   24 ++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/Documentation/Makefile b/Documentation/Makefile
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,7 +1,7 @@
 CG_IGNORE=$(wildcard ../cg-X* ../cg-*.orig ../cg-*.rej)
-CG_SRC=$(filter-out $(CG_IGNORE), $(wildcard ../cg-*))
+CG_SRC=$(filter-out $(CG_IGNORE), $(wildcard ../cg*))
 
-MAN1_TXT=$(patsubst ../cg-%,cg-%.txt,$(CG_SRC))
+MAN1_TXT=$(patsubst ../cg%,cg%.txt,$(CG_SRC))
 MAN7_TXT=cogito.txt
 
 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT)) introduction.html
@@ -54,9 +54,9 @@ install-html: html
 	$(INSTALL) $(DOC_HTML) $(DESTDIR)/$(htmldir)
 
 clean:
-	rm -f *.xml *.html *.1 *.7 cg-*.txt cogito.txt
+	rm -f *.xml *.html *.1 *.7 cg*.txt cogito.txt
 
-.PRECIOUS: cg-%.txt
+.PRECIOUS: cg%.txt
 
 introduction.html: ../README
 	asciidoc -b xhtml11 -d article -f asciidoc.conf -o $@ $<
@@ -73,5 +73,9 @@ introduction.html: ../README
 cogito.txt : make-cogito-asciidoc
 	./make-cogito-asciidoc > $@
 
+# It seems that cg%.txt won't match this so use an explicit rule
+cg.txt : ../cg make-cg-asciidoc
+	./make-cg-asciidoc $< > $@
+
 cg-%.txt : ../cg-% make-cg-asciidoc
 	./make-cg-asciidoc $< > $@
diff --git a/cg b/cg
--- a/cg
+++ b/cg
@@ -1,4 +1,28 @@
 #!/usr/bin/env bash
+#
+# Wrapper for running Cogito commands.
+# Copyright (c) Petr Baudis, 2005
+#
+# Takes a variable number of arguments where the first argument should
+# either be a Cogito command or one of the supported options. If no
+# arguments are specified an overview of all the Cogito commands will be
+# shown.
+#
+# Enables all Cogito commands to be accessed as subcommands, for example
+# is:
+#
+#	cg help
+#	cg-help
+#
+# equivalent.
+#
+# OPTIONS
+# -------
+# --version::
+#	Show the version of the Cogito toolkit. Equivalent to the output
+#	of `cg-version`.
+
+USAGE="cg [--version | COMMAND [ARGS]...]"
 
 cmd="$1"; shift
 case "$cmd" in

-- 
Jonas Fonseca