]> git.ipfire.org Git - thirdparty/patchwork.git/commit
pwclient: rework multi-command help text
authorBrian Norris <computersforpeace@gmail.com>
Fri, 16 Oct 2015 23:39:02 +0000 (16:39 -0700)
committerStephen Finucane <stephen.finucane@intel.com>
Tue, 20 Oct 2015 00:52:13 +0000 (01:52 +0100)
commit252844f51c9f84fe2858832f6b93bd9d41017392
treecdd559324e0493c8465e841c9a1fa194a3cf61d5
parenta466ebb4e7436849f7b627d93fb466b290f194f9
pwclient: rework multi-command help text

Our --help handling is convoluted and confusing, since we're hacking
around using some of argparse's built-in features (like generating
--help arguments for us). It seems like we were hacking around the
conflict between -h used for hashes and -h used for automatic help
flags. Fortunately, Python's argparse provides us with a
'conflict_handler' which will resolve these conflicts for us.

Altogether, this patch means that 'pwclient --help' will not generate a
full recursive print of all subcommand helps (arguably a good thing),
but it provides better automatic formatting of all the supported
subcommands and eliminates some awkward code.

Sample runs:

$ pwclient
usage: pwclient [-h]
                {apply,git-am,get,info,projects,states,view,update,list,search}
                ...

optional arguments:
  -h, --help            show this help message and exit

Commands:
  {apply,git-am,get,info,projects,states,view,update,list,search}
    apply               Apply a patch (in the current dir, using -p1)
    git-am              Apply a patch to current git branch using "git am".
    get                 Download a patch and save it locally
    info                Display patchwork info about a given patch ID
    projects            List all projects
    states              Show list of potential patch states
    view                View a patch
    update              Update patch
    list                List patches, using the optional filters specified
                        below and an optional substring to search for patches
                        by name
    search              Alias for "list"

Use 'pwclient <command> --help' for more info

$ pwclient info --help
usage: pwclient info [--help] [-h HASH] [-p PROJECT] [ID [ID ...]]

positional arguments:
  ID          Patch ID

optional arguments:
  --help      show this help message and exit
  -h HASH     Lookup by patch hash
  -p PROJECT  Lookup patch in project

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/bin/pwclient