git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Adding Correct Useage Notification and -h Help flag
@ 2005-06-14  1:47 James Purser
  2005-06-14  2:23 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: James Purser @ 2005-06-14  1:47 UTC (permalink / raw)
  To: Git Mailing List

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

okay this is my first patch so take it easy on me.

I have added both a Correct Useage notification when git is called on
its own without any other parameters and a -h help flag which lists
available scripts for the git command.

Signed-off-by: James Purser <purserj@k-sit.com>


-- 
James Purser
Winnet Developer
+61 2 4223 4131
http://www.winnet.com.au

[-- Attachment #2: git_patch --]
[-- Type: text/plain, Size: 1021 bytes --]

Added a couple of lines to the git wrapper. Includes Correct Useage and available scripts

---
commit bfe72d41d70f9e4c0a6ab0ec6cf49347f980f4de
tree a8eed80ea2ac00ffee0b4f12ed4c931ca7761000
parent 940c1bb0181cb20454bf3573134175f86983a0ce
author James Purser <purserj@k-sit.com> Tue, 14 Jun 2005 11:40:20 +1000
committer James Purser <purserj@k-sit.com> Tue, 14 Jun 2005 11:40:20 +1000

 git |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/git b/git
--- a/git
+++ b/git
@@ -1,4 +1,29 @@
 #!/bin/sh
-cmd="git-$1-script"
-shift
-exec $cmd "$@"
+if [ "$1" = "" ]
+then
+	echo "Correct Useage: git [-h] [SCRIPT]";
+else 
+	if [ "$1" = "-h" ]
+	then
+		echo "This is a basic script wrapper for certain git functions. The available commands are:
+
+git apply-patch
+git commit
+git cvsimport
+git deltafy
+git diff
+git fetch
+git log
+git merge-one-file
+git prune
+git pull
+git status
+git tag
+";	
+	else
+		cmd="git-$1-script";
+		shift;
+		exec $cmd "$@";
+	fi
+fi
+

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

* Re: [PATCH] Adding Correct Useage Notification and -h Help flag
  2005-06-14  1:47 [PATCH] Adding Correct Useage Notification and -h Help flag James Purser
@ 2005-06-14  2:23 ` Junio C Hamano
  2005-06-14  2:28   ` James Purser
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Junio C Hamano @ 2005-06-14  2:23 UTC (permalink / raw)
  To: purserj; +Cc: git


>>Added a couple of lines to the git wrapper. Includes Correct
>>Useage and available scripts

I like the general direction of making "git" wrapper novice
friendly, but have some suggestions to the implementation.

 (0) Do not mention that only certain subset is accessible.
     Just saying "Available commands are:" would be enough, and
     would not leave the end user wondering what he is missing.

 (1) Instead of explicitly checking for -h, you may want to
     structure it like this:

         #!/bin/sh

         cmd="git-$1-script";
         shift;
         exec $cmd "$@";
         echo "Usage: git <subcommand> [<param>...]"
         echo 'Available commands are:"
         git bar
	 git foo
         ...
         '
         exit 1

     Alternatively, you could say:

         #!/bin/sh

         case "$1" in
         -h)
             echo "Usage: git <subcommand> [<param>...]"
             echo 'Available commands are:
         git bar
	 git foo
         ...
         '
             exit 0 ;;
	 esac

         cmd="git-$1-script";
         shift;
         exec $cmd "$@";
	 git -h
         exit 1

 (2) Maintaining the list of commands by hand in git script
     itself have an advantage that you _could_ describe the
     options and parameters they take, but you are not doing
     that in your patch (hint, hint).

     If all you give is the list of subcommand names, have
     git.in as a source file, and create the "list of available
     commands" from the Makefile, like this:

     === Makefile ===
     ...
     git : git.in
         /bin/sh ls -1 git-*-script | \
         sed -e 's/git-\(.*\)-script/git \1/' >.git-cmd-list
         sed -e '/@@LIST_OF_COMMANDS@@/{s/.*//;r .git-cmd-list;}' <$@.in >$@
         rm -f .git-cmd-list

     === git.in ===
     #!/bin/sh

     cmd="git-$1-script";
     shift;
     exec $cmd "$@";
     echo "Usage: git <subcommand> [<param>...]"
     echo 'Available commands are:
     @@LIST_OF_COMMANDS@@
     '


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

* Re: [PATCH] Adding Correct Useage Notification and -h Help flag
  2005-06-14  2:23 ` Junio C Hamano
@ 2005-06-14  2:28   ` James Purser
  2005-06-14  5:25   ` James Purser
  2005-06-14 21:49   ` James Purser
  2 siblings, 0 replies; 6+ messages in thread
From: James Purser @ 2005-06-14  2:28 UTC (permalink / raw)
  To: git

Thanks for the tips, I shall submit a new patch along these lines when I
get home from work tonight.

On Tue, 2005-06-14 at 12:23, Junio C Hamano wrote:
> >>Added a couple of lines to the git wrapper. Includes Correct
> >>Useage and available scripts
> 
> I like the general direction of making "git" wrapper novice
> friendly, but have some suggestions to the implementation.
> 
>  (0) Do not mention that only certain subset is accessible.
>      Just saying "Available commands are:" would be enough, and
>      would not leave the end user wondering what he is missing.
> 
>  (1) Instead of explicitly checking for -h, you may want to
>      structure it like this:
> 
>          #!/bin/sh
> 
>          cmd="git-$1-script";
>          shift;
>          exec $cmd "$@";
>          echo "Usage: git <subcommand> [<param>...]"
>          echo 'Available commands are:"
>          git bar
> 	 git foo
>          ...
>          '
>          exit 1
> 
>      Alternatively, you could say:
> 
>          #!/bin/sh
> 
>          case "$1" in
>          -h)
>              echo "Usage: git <subcommand> [<param>...]"
>              echo 'Available commands are:
>          git bar
> 	 git foo
>          ...
>          '
>              exit 0 ;;
> 	 esac
> 
>          cmd="git-$1-script";
>          shift;
>          exec $cmd "$@";
> 	 git -h
>          exit 1
> 
>  (2) Maintaining the list of commands by hand in git script
>      itself have an advantage that you _could_ describe the
>      options and parameters they take, but you are not doing
>      that in your patch (hint, hint).
> 
>      If all you give is the list of subcommand names, have
>      git.in as a source file, and create the "list of available
>      commands" from the Makefile, like this:
> 
>      === Makefile ===
>      ...
>      git : git.in
>          /bin/sh ls -1 git-*-script | \
>          sed -e 's/git-\(.*\)-script/git \1/' >.git-cmd-list
>          sed -e '/@@LIST_OF_COMMANDS@@/{s/.*//;r .git-cmd-list;}' <$@.in >$@
>          rm -f .git-cmd-list
> 
>      === git.in ===
>      #!/bin/sh
> 
>      cmd="git-$1-script";
>      shift;
>      exec $cmd "$@";
>      echo "Usage: git <subcommand> [<param>...]"
>      echo 'Available commands are:
>      @@LIST_OF_COMMANDS@@
>      '
> 
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
James Purser
Winnet Developer
+61 2 4223 4131
http://www.winnet.com.au


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

* Re: [PATCH] Adding Correct Useage Notification and -h Help flag
  2005-06-14  2:23 ` Junio C Hamano
  2005-06-14  2:28   ` James Purser
@ 2005-06-14  5:25   ` James Purser
  2005-06-14  5:52     ` Junio C Hamano
  2005-06-14 21:49   ` James Purser
  2 siblings, 1 reply; 6+ messages in thread
From: James Purser @ 2005-06-14  5:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

One thing I would like to double check.

When running git commit I am told to run git-update-cache against the
files I want to commit. Would it be easier to have the git-commit-script
run this itself? Take out that second step and all that.
-- 
James Purser
Winnet Developer
+61 2 4223 4131
http://www.winnet.com.au


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

* Re: [PATCH] Adding Correct Useage Notification and -h Help flag
  2005-06-14  5:25   ` James Purser
@ 2005-06-14  5:52     ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2005-06-14  5:52 UTC (permalink / raw)
  To: purserj; +Cc: git

>>>>> "JP" == James Purser <purserj@winnsw.com.au> writes:

JP> When running git commit I am told to run git-update-cache
JP> against the files I want to commit. Would it be easier to
JP> have the git-commit-script run this itself? Take out that
JP> second step and all that.

That's a question better asked Linus, not me.  My preference
would be (1) to ask the user if he wants us to automatically run
git-update-cache to all of those files, giving him an option to
decline and sort things out himself; or (2) leave things as they
are.

The core GIT treats the index file and the working directory
contents two logically separate entities, and we always require
the user to consciously tell us what to put in and remove from
the index file.  The core GIT is all about committed tree
objects and the index file, and the working directory is merely
a temporary area the user can use to build the state the user
wishes to have in the index file.  From this point of view,
running git-update-cache ourselves without asking the user is a
definite no-no.


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

* Re: [PATCH] Adding Correct Useage Notification and -h Help flag
  2005-06-14  2:23 ` Junio C Hamano
  2005-06-14  2:28   ` James Purser
  2005-06-14  5:25   ` James Purser
@ 2005-06-14 21:49   ` James Purser
  2 siblings, 0 replies; 6+ messages in thread
From: James Purser @ 2005-06-14 21:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

Heres the revised patch along the lines you recommended yesterday. I am
still working on some of the command descriptions.

On the git-update-cache question, I think having a flag [-u] or
something like that in git commit would allow the user to decide to run
git-update-cache on only the files specified in the git commit command.

Signed-off-by: James Purser <purserj@k-sit.com>
On Tue, 2005-06-14 at 12:23, Junio C Hamano wrote:
> >>Added a couple of lines to the git wrapper. Includes Correct
> >>Useage and available scripts
> 
> I like the general direction of making "git" wrapper novice
> friendly, but have some suggestions to the implementation.
> 
>  (0) Do not mention that only certain subset is accessible.
>      Just saying "Available commands are:" would be enough, and
>      would not leave the end user wondering what he is missing.
> 
>  (1) Instead of explicitly checking for -h, you may want to
>      structure it like this:
> 
>          #!/bin/sh
> 
>          cmd="git-$1-script";
>          shift;
>          exec $cmd "$@";
>          echo "Usage: git <subcommand> [<param>...]"
>          echo 'Available commands are:"
>          git bar
> 	 git foo
>          ...
>          '
>          exit 1
> 
>      Alternatively, you could say:
> 
>          #!/bin/sh
> 
>          case "$1" in
>          -h)
>              echo "Usage: git <subcommand> [<param>...]"
>              echo 'Available commands are:
>          git bar
> 	 git foo
>          ...
>          '
>              exit 0 ;;
> 	 esac
> 
>          cmd="git-$1-script";
>          shift;
>          exec $cmd "$@";
> 	 git -h
>          exit 1
> 
>  (2) Maintaining the list of commands by hand in git script
>      itself have an advantage that you _could_ describe the
>      options and parameters they take, but you are not doing
>      that in your patch (hint, hint).
> 
>      If all you give is the list of subcommand names, have
>      git.in as a source file, and create the "list of available
>      commands" from the Makefile, like this:
> 
>      === Makefile ===
>      ...
>      git : git.in
>          /bin/sh ls -1 git-*-script | \
>          sed -e 's/git-\(.*\)-script/git \1/' >.git-cmd-list
>          sed -e '/@@LIST_OF_COMMANDS@@/{s/.*//;r .git-cmd-list;}' <$@.in >$@
>          rm -f .git-cmd-list
> 
>      === git.in ===
>      #!/bin/sh
> 
>      cmd="git-$1-script";
>      shift;
>      exec $cmd "$@";
>      echo "Usage: git <subcommand> [<param>...]"
>      echo 'Available commands are:
>      @@LIST_OF_COMMANDS@@
>      '
> 
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: git_patch --]
[-- Type: text/plain, Size: 1835 bytes --]

Make the git wrapper a little bit more newbie friendly, when called on its own or with the -h flag will return a list of the commands available

---
commit 2ad499f75f0982953e43904085bd1b48dd821c4d
tree f137c4f3f5ee027b8b4d25a0434929e12eb7c51c
parent de4971b50076b5ef901c2ae0bbee9dd2c14f06ea
parent de4971b50076b5ef901c2ae0bbee9dd2c14f06ea
author James Purser <purserj@k-sit.com> Wed, 15 Jun 2005 07:43:20
committer James Purser <purserj@k-sit.com> Wed, 15 Jun 2005 07:43:20

 git |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/git b/git
--- a/git
+++ b/git
@@ -1,4 +1,56 @@
 #!/bin/sh
-cmd="git-$1-script"
-shift
-exec $cmd "$@"
+
+case "$1" in
+-h|"")
+	echo "Useage: git <subcommand> [<param 1>, <param 2> ...]"
+	echo "Available commands are:
+
+git apply-patch <patch file>
+
+	Applies patch file to local files
+	
+git commit <file 1> <file 2> ...
+
+	Commits local changes to the cache. Before running this script you will need to run git-update-cache on the files you wish to commit.
+
+	Will accept wildcards ie git commit git-*-scripts
+
+git cvsimport [-v] [-z fuzz] <cvsroot> <module>
+	
+	CVS to Git import tool. Relies on the cvsps package at least 2.1
+	
+	-v Verbose output
+	-z 
+	<cvsroot> Path to CVS Repository
+	<module> Module you want to import into git
+
+git deltafy:
+
+git diff [<File 1>, <File 2>, ...]
+
+	Diffs between the git cache and specified files. If no files are specified then creates a Diff between contents of the cache and all current files.
+
+git fetch:
+
+git log:
+
+git merge-one-file:
+
+git prune:
+
+git pull:
+
+git status:
+
+git tag:
+"
+	exit 0 ;;
+esac
+
+cmd="git-$1-script";
+shift;
+exec $cmd "$@";
+git -h
+exit 1
+
+

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14  1:47 [PATCH] Adding Correct Useage Notification and -h Help flag James Purser
2005-06-14  2:23 ` Junio C Hamano
2005-06-14  2:28   ` James Purser
2005-06-14  5:25   ` James Purser
2005-06-14  5:52     ` Junio C Hamano
2005-06-14 21:49   ` James Purser

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