git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yaacov Akiba Slama <ya@slamail.org>
To: Yaacov Akiba Slama <ya@slamail.org>
Cc: Git Mailing List <git@vger.kernel.org>,
	Yaacov Akiba Slama <yaslama@laptop2.localdomain>
Subject: [PATCH]: Add git help command. A good patch this time, I hope
Date: Sun, 6 Nov 2005 12:39:17 +0200	[thread overview]
Message-ID: <11312735573649-git-send-email-ya@slamail.org> (raw)
In-Reply-To: <436D276F.7010302@slamail.org>

git help COMMAND will call "man COMMAND" if there is a manpage.
If there is no manpage for the command, a simple help will be shown.

Signed-off-by: Yaacov Akiba Slama <yaslama@laptop2.localdomain>

---

 .gitignore  |    1 +
 Makefile    |    2 +-
 git-help.sh |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 git.sh      |   49 +---------------------------------------
 4 files changed, 76 insertions(+), 49 deletions(-)
 create mode 100755 git-help.sh

applies-to: 5af1b5b93257ecfe993bb24975bf596faa342758
e45c839c235cfd3d60cf611f420742bebdd0fe20
diff --git a/.gitignore b/.gitignore
index 3edf6b4..a412a09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ git-format-patch
 git-fsck-objects
 git-get-tar-commit-id
 git-grep
+git-help
 git-hash-object
 git-http-fetch
 git-index-pack
diff --git a/Makefile b/Makefile
index 6c01dc2..fc42049 100644
--- a/Makefile
+++ b/Makefile
@@ -81,7 +81,7 @@ SCRIPT_SH = \
 	git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \
 	git-cherry.sh git-clone.sh git-commit.sh \
 	git-count-objects.sh git-diff.sh git-fetch.sh \
-	git-format-patch.sh git-log.sh git-ls-remote.sh \
+	git-format-patch.sh git-help.sh git-log.sh git-ls-remote.sh \
 	git-merge-one-file.sh git-octopus.sh git-parse-remote.sh \
 	git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
 	git-repack.sh git-request-pull.sh git-reset.sh \
diff --git a/git-help.sh b/git-help.sh
new file mode 100755
index 0000000..a415f0c
--- /dev/null
+++ b/git-help.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+cmd=
+path=$(dirname "$0")
+case "$#" in
+0)	;;
+*)	cmd="$1"
+	shift
+
+        man -w -W git-$cmd &> /dev/null && man git-$cmd && exit 0
+esac
+
+case "$cmd" in
+	help)
+	cmd=""
+	;;
+esac
+
+if [ -n "$cmd" ]; then
+    echo "git command '$cmd' not found."
+    echo
+fi
+
+echo "Usage: git COMMAND [OPTIONS] [TARGET]"
+echo "Type 'git help COMMAND' for help on a specific command."
+echo
+
+echo "git commands are:"
+
+fmt <<\EOF | sed -e 's/^/    /'
+add
+apply
+archimport
+bisect
+branch
+checkout
+cherry
+clone
+commit
+count-objects
+cvsimport
+diff
+fetch
+format-patch
+fsck-objects
+get-tar-commit-id
+help
+init-db
+log
+ls-remote
+octopus
+pack-objects
+parse-remote
+patch-id
+prune
+pull
+push
+rebase
+relink
+rename
+repack
+request-pull
+reset
+resolve
+revert
+send-email
+shortlog
+show-branch
+status
+tag
+verify-tag
+whatchanged
+EOF
diff --git a/git.sh b/git.sh
index 94940ae..995df00 100755
--- a/git.sh
+++ b/git.sh
@@ -25,52 +25,5 @@ case "$#" in
 	;;
 esac
 
-echo "Usage: git COMMAND [OPTIONS] [TARGET]"
-if [ -n "$cmd" ]; then
-    echo "git command '$cmd' not found."
-fi
-echo "git commands are:"
+exec "$path/git-help" "$cmd"
 
-fmt <<\EOF | sed -e 's/^/    /'
-add
-apply
-archimport
-bisect
-branch
-checkout
-cherry
-clone
-commit
-count-objects
-cvsimport
-diff
-fetch
-format-patch
-fsck-objects
-get-tar-commit-id
-init-db
-log
-ls-remote
-octopus
-pack-objects
-parse-remote
-patch-id
-prune
-pull
-push
-rebase
-relink
-rename
-repack
-request-pull
-reset
-resolve
-revert
-send-email
-shortlog
-show-branch
-status
-tag
-verify-tag
-whatchanged
-EOF
---
0.99.9.GIT

      parent reply	other threads:[~2005-11-06 10:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <436D2269.6090605@slamail.org>
2005-11-05 21:43 ` git binary directory? Yaacov Akiba Slama
2005-11-06  8:56   ` Ben Clifford
2005-11-06 13:13     ` Nikolai Weibull
2005-11-06 14:05       ` Johannes Schindelin
2005-11-06 15:03         ` Nikolai Weibull
2005-11-06 10:31   ` [PATCH] Add git help command Yaacov Akiba Slama
2005-11-06 10:39   ` Yaacov Akiba Slama [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11312735573649-git-send-email-ya@slamail.org \
    --to=ya@slamail.org \
    --cc=git@vger.kernel.org \
    --cc=yaslama@laptop2.localdomain \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).