git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add git-help-script
@ 2005-06-07 14:19 Jason McMullan
  2005-06-07 14:25 ` McMullan, Jason
  0 siblings, 1 reply; 2+ messages in thread
From: Jason McMullan @ 2005-06-07 14:19 UTC (permalink / raw)
  To: torvalds, git

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 ========
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 ========


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

* Re: [PATCH] Add git-help-script
  2005-06-07 14:19 [PATCH] Add git-help-script Jason McMullan
@ 2005-06-07 14:25 ` McMullan, Jason
  0 siblings, 0 replies; 2+ messages in thread
From: McMullan, Jason @ 2005-06-07 14:25 UTC (permalink / raw)
  To: Linus Torvalds, GIT Mailling list

[-- Attachment #1: Type: text/plain, Size: 4041 bytes --]

NOTE: This patch requires '[PATCH] Add missing Documention/*'


Here's the example output of 'git-help-script', which is called
when the user doesn't supply any options to the 'git' script wrapper,
or -h, or --help


$ git 
Commands:

    git                 the stupid content tracker
    git apply-patch     Sample script to apply the diffs from git-diff-*
    git commit          Commit working directory

    git deltafy         Convery repository into delta format
    git fetch           Fetch an object from a remote repository
    git help            Short help of all the git commands and scripts
    git log             
    git merge-one-file  The standard helper program to use with
"git-merge-cache"
    git prune           Prunes all unreachable objects from the object
                        database
    git pull            Script used by Linus to pull and merge a
                        remote repository
    git resolve         Script used to merge two trees
    git-shortlog        
    git status          
    git tag             An example script to create a tag object
                        signed with GPG
    git-whatchanged     Find out what changed
    git-apply           Apply a patch against the current index
cache/working
                        directory
    git-cat-file        Provide content or type information for
repository
                        objects
    git-check-files     Verify a list of files are up-to-date
    git-checkout-cache  Copy files from the cache to the working
                        directory
    git-commit-tree     Creates a new commit object
    git-convert-cache   Converts old-style GIT repository
    git-diff-cache      Compares content and mode of blobs between
                        the cache and repository
    git-diff-files      Compares files in the working tree and the
                        cache
    git-diff-helper     Generates patch format output for git-diff-*
    git-diff-tree       Compares the content and mode of blobs found
                        via two tree objects
    git-export          Exports each commit and a diff against each
                        of its parents
    git-fsck-cache      Verifies the connectivity and validity of
                        the objects in the database
    git-get-tar-commit-idShow the commit ID embedded in a git-tar-tree
                        file.
    git-http-pull       Downloads a remote GIT repository via HTTP
    git-init-db         Creates an empty git object database
    git-local-pull      Duplicates another GIT repository on a local
                        system
    git-ls-files        Information about files in the cache/working
                        directory
    git-ls-tree         Lists the contents of a tree object.
    git-merge-base      Finds as good a common ancestor as possible
                        for a merge
    git-merge-cache     Runs a merge for files needing merging
    git-mkdelta         Creates a delta object
    git-mktag           Creates a tag object
    git-read-tree       Reads tree information into the directory
                        cache
    git-rev-list        Lists commit objects in reverse chronological
                        order
    git-rev-tree        Provides the revision tree for one or more
                        commits
    git-ssh-pull        Pulls from a remote repository over ssh
connection
    git-ssh-push        Pushes to a remote repository over ssh
connection
    git-stripspace      Strip space from stdin
    git-tar-tree        Creates a tar archive of the files in the
                        named tree
    git-unpack-file     Creates a temporary file with a blob's contents
    git-update-cache    Modifies the index or directory cache
    git-write-blob      Creates a blob from a file
    git-write-tree      Creates a tree from the current cache

-- 
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-07 14:19 [PATCH] Add git-help-script Jason McMullan
2005-06-07 14:25 ` McMullan, Jason

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).