Order options lexicographicaly.

This commit is contained in:
Darko Poljak 2016-08-15 16:37:38 +02:00
parent 7cc7c18e77
commit adac0113c5
2 changed files with 24 additions and 26 deletions

View file

@ -15,9 +15,9 @@ SYNOPSIS
cdist banner [-h] [-d] [-v] cdist banner [-h] [-d] [-v]
cdist config [-h] [-d] [-v] [-c CONF_DIR] [-f HOSTFILE] [-i MANIFEST] cdist config [-h] [-d] [-v] [-b] [-c CONF_DIR] [-f HOSTFILE]
[-n] [-o OUT_PATH] [-p] [-s] [--remote-copy REMOTE_COPY] [-i MANIFEST] [-j [JOBS]] [-n] [-o OUT_PATH] [-p] [-s]
[--remote-exec REMOTE_EXEC] [-j [JOBS]] [-b] [--remote-copy REMOTE_COPY] [--remote-exec REMOTE_EXEC]
[host [host ...]] [host [host ...]]
cdist shell [-h] [-d] [-v] [-s SHELL] cdist shell [-h] [-d] [-v] [-s SHELL]
@ -62,6 +62,11 @@ CONFIG
------ ------
Configure one or more hosts. Configure one or more hosts.
.. option:: -b, --enable-beta
Enable beta functionalities. Beta functionalities include the
following options: -j/--jobs.
.. option:: -c CONF_DIR, --conf-dir CONF_DIR .. option:: -c CONF_DIR, --conf-dir CONF_DIR
Add a configuration directory. Can be specified multiple times. Add a configuration directory. Can be specified multiple times.
@ -83,6 +88,11 @@ Configure one or more hosts.
Path to a cdist manifest or - to read from stdin Path to a cdist manifest or - to read from stdin
.. option:: -j [JOBS], --jobs [JOBS]
Specify the maximum number of parallel jobs; currently only
global explorers are supported (currently in beta)
.. option:: -n, --dry-run .. option:: -n, --dry-run
Do not execute code Do not execute code
@ -107,16 +117,6 @@ Configure one or more hosts.
Command to use for remote execution (should behave like ssh) Command to use for remote execution (should behave like ssh)
.. option:: -j [JOBS], --jobs [JOBS]
Specify the maximum number of parallel jobs; currently only
global explorers are supported (currently in beta)
.. option:: -b, --enable-beta
Enable beta functionalities. Beta functionalities include the
following options: -j/--jobs.
SHELL SHELL
----- -----
This command allows you to spawn a shell that enables access This command allows you to spawn a shell that enables access

View file

@ -48,8 +48,6 @@ def check_beta(args_dict):
# Check only if beta is not enabled: if beta option is specified then # Check only if beta is not enabled: if beta option is specified then
# raise error. # raise error.
if not args_dict['beta']: if not args_dict['beta']:
err_msg = ("\'{}\' is beta, but beta is not enabled. If you want "
"to use it please enable beta functionalities.")
cmd = args_dict['command'] cmd = args_dict['command']
for arg in BETA_ARGS[cmd]: for arg in BETA_ARGS[cmd]:
if arg in args_dict: if arg in args_dict:
@ -97,6 +95,11 @@ def commandline():
'config', parents=[parser['loglevel']]) 'config', parents=[parser['loglevel']])
parser['config'].add_argument( parser['config'].add_argument(
'host', nargs='*', help='host(s) to operate on') 'host', nargs='*', help='host(s) to operate on')
parser['config'].add_argument(
'-b', '--enable-beta',
help=('Enable beta functionalities. Beta functionalities '
'include the following options: -j/--jobs.'),
action='store_true', dest='beta', default=False)
parser['config'].add_argument( parser['config'].add_argument(
'-c', '--conf-dir', '-c', '--conf-dir',
help=('Add configuration directory (can be repeated, ' help=('Add configuration directory (can be repeated, '
@ -112,6 +115,12 @@ def commandline():
'-i', '--initial-manifest', '-i', '--initial-manifest',
help='Path to a cdist manifest or \'-\' to read from stdin.', help='Path to a cdist manifest or \'-\' to read from stdin.',
dest='manifest', required=False) dest='manifest', required=False)
parser['config'].add_argument(
'-j', '--jobs', nargs='?', type=check_positive_int,
help=('Specify the maximum number of parallel jobs, currently '
'only global explorers are supported (currently in beta'),
action='store', dest='jobs',
const=multiprocessing.cpu_count())
parser['config'].add_argument( parser['config'].add_argument(
'-n', '--dry-run', '-n', '--dry-run',
help='Do not execute code', action='store_true') help='Do not execute code', action='store_true')
@ -140,17 +149,6 @@ def commandline():
'(should behave like ssh)'), '(should behave like ssh)'),
action='store', dest='remote_exec', action='store', dest='remote_exec',
default=os.environ.get('CDIST_REMOTE_EXEC')) default=os.environ.get('CDIST_REMOTE_EXEC'))
parser['config'].add_argument(
'-j', '--jobs', nargs='?', type=check_positive_int,
help=('Specify the maximum number of parallel jobs, currently '
'only global explorers are supported (currently in beta'),
action='store', dest='jobs',
const=multiprocessing.cpu_count())
parser['config'].add_argument(
'-b', '--enable-beta',
help=('Enable beta functionalities. Beta functionalities '
'include the following options: -j/--jobs.'),
action='store_true', dest='beta', default=False)
parser['config'].set_defaults(func=cdist.config.Config.commandline) parser['config'].set_defaults(func=cdist.config.Config.commandline)
# Shell # Shell