Re: [PATCH] Adding Correct Useage Notification and -h Help flag
- From
- James Purser <purserj@winnsw.com.au>
- Date
- Jun 14, 2005, 21:49 UTC
- Message-ID
- <1118785776.3068.4.camel@kryten>
- In-Reply-To
- <7vmzptbrsg.fsf@assigned-by-dhcp.cox.net>
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:
Show 79 quoted lines
> >>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.htmlMake 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 + +