From 5afead09dd98b41cdf3dbe62e1ccfd95a54f7c00 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 12 Nov 2012 16:25:52 -0500 Subject: Completely remove cfg's disable_interspersed_args() The use case for disable_interspersed_args() is that nova-manage needs to be able to parse sub-commands. We now have a add_cli_subparsers() method which better supports this use case. Change-Id: I1fcd15889745fe4ddff0ac4bacf385004f9b61af --- openstack/common/cfg.py | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) (limited to 'openstack/common') diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py index c256ca7..ee5fd4f 100644 --- a/openstack/common/cfg.py +++ b/openstack/common/cfg.py @@ -205,21 +205,7 @@ Option values may reference other values using PEP 292 string substitution:: Note that interpolation can be avoided by using '$$'. -For command line utilities that dispatch to other command line utilities, the -disable_interspersed_args() method is available. If this this method is called, -then parsing e.g.:: - - script --verbose cmd --debug /tmp/mything - -will no longer return:: - - ['cmd', '/tmp/mything'] - -as the leftover arguments, but will instead return:: - - ['cmd', '--debug', '/tmp/mything'] - -i.e. argument parsing is stopped at the first non-option argument. +FIXME(markmc): document add_cli_subparsers() Options may be declared as required so that an error is raised if the user does not supply a value for the option. @@ -1055,7 +1041,6 @@ class ConfigOpts(collections.Mapping): self._cli_values = {} self.__cache = {} self._config_opts = [] - self._disable_interspersed_args = False def _pre_setup(self, project, prog, version, usage, default_config_files): """Initialize a ConfigCliParser object for option parsing.""" @@ -1404,33 +1389,6 @@ class ConfigOpts(collections.Mapping): info.pop('default', None) info.pop('override', None) - def disable_interspersed_args(self): - """Set parsing to stop on the first non-option. - - If this this method is called, then parsing e.g. - - script --verbose cmd --debug /tmp/mything - - will no longer return: - - ['cmd', '/tmp/mything'] - - as the leftover arguments, but will instead return: - - ['cmd', '--debug', '/tmp/mything'] - - i.e. argument parsing is stopped at the first non-option argument. - """ - # do nothing - self._disable_interspersed_args = True - - def enable_interspersed_args(self): - """Set parsing to not stop on the first non-option. - - This it the default behaviour.""" - # do nothing - self._disable_interspersed_args = False - def find_file(self, name): """Locate a file located alongside the config files. -- cgit