[Freeipa-devel] [PATCH] 203 Add argument help to CLI

Martin Kosek mkosek at redhat.com
Fri Feb 3 17:10:09 UTC 2012


On Tue, 2012-01-31 at 15:38 +0100, Martin Kosek wrote:
> On Mon, 2012-01-30 at 11:22 -0500, Rob Crittenden wrote:
> > Martin Kosek wrote:
> > > An example of the improved help:
> > >
> > > # ipa help user-add
> > > Purpose: Add a new user.
> > > Usage: ipa [global-options] user-add LOGIN [options]
> > >
> > > Positional arguments:
> > > LOGIN: User login
> > >
> > > Options:
> > >    -h, --help         show this help message and exit
> > >    --first=STR        First name
> > >    --last=STR         Last name
> > >    --cn=STR           Full name
> > > ...
> > >
> > >
> > > We may want to improve help for most arguments we use. Most of them are
> > > missing. In this patch I updated just the CRITERIA argument that was
> > > complained about in the relevant BZ.
> > >
> > > Martin
> > 
> > Patch looks ok, I just think the output could be improved.
> > 
> > I think it should look similar to the existing usage output, so, similar 
> > indention and description columns lined up:
> > 
> > Usage: ipa [global-options] user-add LOGIN [options]
> > 
> > Positional arguments:
> >    LOGIN              User login
> > 
> > Options:
> >    -h, --help         show this help message and exit
> > 
> > rob
> 
> I agree. I refactored the patch to integrate better with OptionParser
> and rather provide a support of argument help directly instead of
> misusing description field.
> 
> New patch adds a formatter capable of formatting arguments consistently
> with options format (as you proposed).
> 
> Martin

Rob had a good point that the last patch did not indent arguments in the
same way as options are indented. Attached patch should make it
consistent.

This is how dnsrecord-add help now looks like:

# ipa help dnsrecord-add
Purpose: Add new DNS resource record.
Usage: ipa [global-options] dnsrecord-add DNSZONE NAME [options]

Positional arguments:
  DNSZONE               Zone name
  NAME                  Record name

Options:
  -h, --help            show this help message and exit
  --ttl=INT             Time to live
...

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mkosek-203-3-add-argument-help-to-cli.patch
Type: text/x-patch
Size: 5934 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120203/115e3e19/attachment.bin>


More information about the Freeipa-devel mailing list