Re: [PATCH] Adding Correct Useage Notification and -h Help flag

From: James Purser <purserj@winnsw.com.au>
Date: 2005-06-14 12:28:13
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

-
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
Received on Tue Jun 14 12:28:44 2005

This archive was generated by hypermail 2.1.8 : 2005-06-14 12:28:45 EST