Id: 13d680c11f5403f3b1b48e71416e36770cd0aecf tree 91e05412806336f2c9d989b8d9a2eccb21281efe parent e774aa5641ca2267e7aba7338da3f7e355b7fb78 author Jason McMullan <jason.mcmullan@gmail.com> 1118153648 -0400 committer Jason McMullan <jason.mcmullan@gmail.com> 1118153648 -0400
Add: 'git help' aka 'git-help-script', built from Documentation/* information
======== diff against e774aa5641ca2267e7aba7338da3f7e355b7fb78 ========
Show changes to 3 files +56 −3
Documentation/git-help-script.txt, Makefile, git
diff --git a/Documentation/git-help-script.txt b/Documentation/git-help-script.txt new file mode 100644 --- /dev/null +++ b/Documentation/git-help-script.txt @@ -0,0 +1,29 @@ +git-help-script(1) +================== +v0.1, May 2005 + +NAME +---- +git-help-script - Short help of all the git commands and scripts + + +SYNOPSIS +-------- +'git-help-script' + +DESCRIPTION +----------- +Shows a brief summary of all the git-* commands. + +Author +------ +Written by Jason McMullan <jason.mcmullan@timesys.com> + +Documentation +-------------- +Documentation by Jason McMullan and the git-list <git@vger.kernel.org>. + +GIT +--- +Part of the link:git.html[git] suite + diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ INSTALL=install SCRIPTS=git git-apply-patch-script git-merge-one-file-script git-prune-script \ git-pull-script git-tag-script git-resolve-script git-whatchanged \ git-deltafy-script git-fetch-script git-status-script git-commit-script \ - git-log-script git-shortlog + git-log-script git-shortlog git-help-script PROG= git-update-cache git-diff-files git-init-db git-write-tree \ git-read-tree git-commit-tree git-cat-file git-fsck-cache \ @@ -84,6 +84,26 @@ test-delta: test-delta.c diff-delta.o pa git-%: %.c $(LIB_FILE) $(CC) $(CFLAGS) -o $@ $(filter %.c,$^) $(LIBS) +git-help-script: Makefile $(patsubst %,Documentation/%.txt,$(SCRIPTS) $(PROG)) + echo "#!/bin/sh" >git-help-script + echo "cat <<EOF" >>git-help-script + echo "Commands:" >>git-help-script + echo >>git-help-script + for cmd in $(sort $(SCRIPTS)) $(sort $(PROG)); do \ + doc="Documentation/$$cmd.txt"; \ + if [ ! -e "$$doc" ]; then \ + echo "MISSING: $$doc" 1>&2; \ + rm -f git-help-script; \ + exit 1; \ + fi; \ + desc=`grep "^$$cmd - " $$doc | cut -d' ' -f3-` ; \ + desc=`echo "$$desc" | sed -e 's/\(.\{40\}\) /\1\n /g'` ; \ + cmd=`echo $$cmd | sed -e 's/^git-\(.*\)-script$$/git \1/'`; \ + printf " %-20s%s\n" "$$cmd" "$$desc" >>git-help-script; \ + done + echo "EOF" >>git-help-script + echo "exit 1" >>git-help-script + git-update-cache: update-cache.c git-diff-files: diff-files.c git-init-db: init-db.c @@ -143,7 +163,7 @@ test: all $(MAKE) -C t/ all clean: - rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE) + rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE) git-help-script $(MAKE) -C Documentation/ clean backup: clean diff --git a/git b/git --- a/git +++ b/git @@ -1,4 +1,8 @@ #!/bin/sh -cmd="git-$1-script" + +cmd="$1" + +[ -z "$cmd" -o "$cmd" = "-h" -o "$cmd" = "--help" ] && cmd="help" +cmd="git-$cmd-script" shift exec $cmd "$@" ======== end ========