diff options
-rw-r--r-- | sos/__init__.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sos/__init__.py b/sos/__init__.py index ff3153aa..f169f369 100644 --- a/sos/__init__.py +++ b/sos/__init__.py @@ -16,7 +16,6 @@ gettext to internationalize messages. """ import gettext -from collections import deque __version__ = "3.5" @@ -172,4 +171,19 @@ class SoSOptions(object): if replace or not getattr(self, arg): self._copy_opt(arg, src) + def dict(self): + """Return this ``SoSOptions`` option values as a dictionary of + argument name to value mappings. + + :returns: a name:value dictionary of option values. + """ + odict = {} + for arg in _arg_names: + value = getattr(self, arg) + # Do not attempt to store --add-preset <name> in presets + if arg == 'add_preset': + value = None + odict[arg] = value + return odict + # vim: set et ts=4 sw=4 : |