diff options
| author | Petr Viktorin <pviktori@redhat.com> | 2014-03-18 10:22:17 +0100 |
|---|---|---|
| committer | Petr Viktorin <pviktori@redhat.com> | 2014-03-21 12:49:21 +0100 |
| commit | 84c401f7d605cde6d0ca1429a7fc4c2ef65a38e1 (patch) | |
| tree | 26836884bb76d3d6e6b3eecdcc0fa2baa4ef8d14 | |
| parent | d2e3af88eb49d4e537dac327d9ba731bc96c1c9d (diff) | |
| download | freeipa-84c401f7d605cde6d0ca1429a7fc4c2ef65a38e1.tar.gz freeipa-84c401f7d605cde6d0ca1429a7fc4c2ef65a38e1.tar.xz freeipa-84c401f7d605cde6d0ca1429a7fc4c2ef65a38e1.zip | |
cli: Show list of values in --help for all Enums
Previously only the StrEnum param type had the list of values
listed in the help.
Extend the functionality to any kind of Enum.
| -rw-r--r-- | ipalib/cli.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index a9acde3bd..19f27b17a 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -47,7 +47,7 @@ from errors import (PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError, NotFound, NotConfiguredError, PromptFailed) from constants import CLI_TAB -from parameters import File, Str, StrEnum, Any +from parameters import File, Str, Enum, Any from text import _ from ipapython.version import API_VERSION @@ -1117,10 +1117,10 @@ class cli(backend.Executioner): kw['action'] = 'store_false' else: kw['action'] = 'store_true' - elif isinstance(option, StrEnum): - kw['metavar'] = metavar=map(lambda x: str(x), option.values) + elif isinstance(option, Enum): + kw['metavar'] = list(str(x) for x in option.values) else: - kw['metavar'] = metavar=option.__class__.__name__.upper() + kw['metavar'] = option.__class__.__name__.upper() if option.cli_short_name: o = optparse.make_option('-%s' % option.cli_short_name, '--%s' % to_cli(option.cli_name), **kw) |
