[Freeipa-devel] [PATCH] 0018 Unroll StrEnum values when displaying help

Rob Crittenden rcritten at redhat.com
Tue Oct 4 13:49:45 UTC 2011


Alexander Bokovoy wrote:
> Hi,
>
> when help is displayed, for options that require values we show their
> type. With string enumerations this does not really help to the user
> as it is unclear what are the values of the enumeration.
>
> Attached patch fixes it by providing nicer list of possible values.
>
> https://fedorahosted.org/freeipa/ticket/1848
>
> As result, instead of what is shown in the ticket:
> ------------------------------------------------------------
> [root at kungfupanda ~]# ipa help hbacrule-add
> Purpose: Create a new HBAC rule.
> Usage: ipa [global-options] hbacrule-add NAME [options]
>
> Options:
>    -h, --help            show this help message and exit
>    --usercat=STRENUM     User category the rule applies to
>    --hostcat=STRENUM     Host category the rule applies to
>    --srchostcat=STRENUM  Source host category the rule applies to
>    --servicecat=STRENUM  Service category the rule applies to
> -------------------------------------------------------------
>
> one would get following:
>
> ------------------------------------------------------------
> [root at kungfupanda ~]# ipa help hbacrule-add
> Purpose: Create a new HBAC rule.
> Usage: ipa [global-options] hbacrule-add NAME [options]
>
> Options:
>    -h, --help            show this help message and exit
>    --usercat=['all']     User category the rule applies to
>    --hostcat=['all']     Host category the rule applies to
>    --srchostcat=['all']  Source host category the rule applies to
>    --servicecat=['all']  Service category the rule applies to
> ------------------------------------------------------------
>
> It becomes even more reasonable with type or class options -- overall
> we have 65 StrEnums in current set of options.
>
> For example, in dnsrecord-add --class option was shown as
>    --class=STRENUM      	DNS class
>
> With the patch attached it will be more understandable:
> ------------------------------------------------------------
> [root at host3 ~]# ipa help dnsrecord-add
> Purpose: Add new DNS resource record.
> Usage: ipa [global-options] dnsrecord-add DNSZONE NAME [options]
>
> Options:
>    -h, --help            show this help message and exit
>    --ttl=INT             Time to live
>    --class=['IN', 'CS', 'CH', 'HS']
>                          DNS class
>    --addattr=STR         Add an attribute/value pair. Format is attr=value. The
>                          attribute must be part of the schema.
>    --setattr=STR         Set an attribute to a name/value pair. Format is
>                          attr=value. For multi-valued attributes, the command
>                          replaces the values already present.
> ------------------------------------------------------------

ack, pushed to master and ipa-2-1




More information about the Freeipa-devel mailing list