summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openstack/common/cfg.py44
-rw-r--r--tests/unit/test_cfg.py12
2 files changed, 1 insertions, 55 deletions
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.
diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py
index b26f932..48732d5 100644
--- a/tests/unit/test_cfg.py
+++ b/tests/unit/test_cfg.py
@@ -267,18 +267,6 @@ class CliOptsTestCase(BaseTestCase):
self.assertEquals(self.conf.config_file, paths)
- def test_disable_interspersed_args(self):
- self.conf.register_cli_opt(BoolOpt('foo'))
- self.conf.register_cli_opt(BoolOpt('bar'))
-
- args = ['--foo', 'blaa', '--bar']
-
- self.assertEquals(self.conf(args), args[1:2])
- self.conf.disable_interspersed_args()
- #self.assertEquals(self.conf(args), args[1:])
- self.conf.enable_interspersed_args()
- self.assertEquals(self.conf(args), args[1:2])
-
class ConfigFileOptsTestCase(BaseTestCase):