tools: remove obsolete _want_app argument
It was copied from core-admin but it doesn't make sense here (there is no loading of qubes.xml).
This commit is contained in:
parent
cc71dd5876
commit
e9120e3196
@ -322,9 +322,6 @@ class PoolsAction(QubesAction):
|
|||||||
class QubesArgumentParser(argparse.ArgumentParser):
|
class QubesArgumentParser(argparse.ArgumentParser):
|
||||||
'''Parser preconfigured for use in most of the Qubes command-line tools.
|
'''Parser preconfigured for use in most of the Qubes command-line tools.
|
||||||
|
|
||||||
:param bool want_app: instantiate :py:class:`qubes.Qubes` object
|
|
||||||
:param bool want_app_no_instance: don't actually instantiate \
|
|
||||||
:py:class:`qubes.Qubes` object, just add argument for custom xml file
|
|
||||||
:param mixed vmname_nargs: The number of ``VMNAME`` arguments that should be
|
:param mixed vmname_nargs: The number of ``VMNAME`` arguments that should be
|
||||||
consumed. Values include:
|
consumed. Values include:
|
||||||
* N (an integer) consumes N arguments (and produces a list)
|
* N (an integer) consumes N arguments (and produces a list)
|
||||||
@ -340,20 +337,11 @@ class QubesArgumentParser(argparse.ArgumentParser):
|
|||||||
``--verbose`` and ``--quiet``
|
``--verbose`` and ``--quiet``
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, want_app=True, want_app_no_instance=False,
|
def __init__(self, vmname_nargs=None, **kwargs):
|
||||||
vmname_nargs=None, **kwargs):
|
|
||||||
|
|
||||||
super(QubesArgumentParser, self).__init__(add_help=False, **kwargs)
|
super(QubesArgumentParser, self).__init__(add_help=False, **kwargs)
|
||||||
|
|
||||||
self._want_app = want_app
|
|
||||||
self._want_app_no_instance = want_app_no_instance
|
|
||||||
self._vmname_nargs = vmname_nargs
|
self._vmname_nargs = vmname_nargs
|
||||||
if self._want_app:
|
|
||||||
self.add_argument('--qubesxml', metavar='FILE', action='store',
|
|
||||||
dest='app', help=argparse.SUPPRESS)
|
|
||||||
self.add_argument('--offline-mode', action='store_true',
|
|
||||||
default=None, dest='offline_mode', help=argparse.SUPPRESS)
|
|
||||||
|
|
||||||
|
|
||||||
self.add_argument('--verbose', '-v', action='count',
|
self.add_argument('--verbose', '-v', action='count',
|
||||||
help='increase verbosity')
|
help='increase verbosity')
|
||||||
@ -384,12 +372,11 @@ class QubesArgumentParser(argparse.ArgumentParser):
|
|||||||
app = kwargs.pop('app', None)
|
app = kwargs.pop('app', None)
|
||||||
namespace = super(QubesArgumentParser, self).parse_args(*args, **kwargs)
|
namespace = super(QubesArgumentParser, self).parse_args(*args, **kwargs)
|
||||||
|
|
||||||
if self._want_app and not self._want_app_no_instance:
|
self.set_qubes_verbosity(namespace)
|
||||||
self.set_qubes_verbosity(namespace)
|
if app is not None:
|
||||||
if app is not None:
|
namespace.app = app
|
||||||
namespace.app = app
|
else:
|
||||||
else:
|
namespace.app = qubesadmin.Qubes()
|
||||||
namespace.app = qubesadmin.Qubes()
|
|
||||||
|
|
||||||
for action in self._actions:
|
for action in self._actions:
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
|
@ -207,8 +207,7 @@ def get_parser(device_class=None):
|
|||||||
"""Create :py:class:`argparse.ArgumentParser` suitable for
|
"""Create :py:class:`argparse.ArgumentParser` suitable for
|
||||||
:program:`qvm-block`.
|
:program:`qvm-block`.
|
||||||
"""
|
"""
|
||||||
parser = qubesadmin.tools.QubesArgumentParser(description=__doc__,
|
parser = qubesadmin.tools.QubesArgumentParser(description=__doc__)
|
||||||
want_app=True)
|
|
||||||
parser.register('action', 'parsers',
|
parser.register('action', 'parsers',
|
||||||
qubesadmin.tools.AliasedSubParsersAction)
|
qubesadmin.tools.AliasedSubParsersAction)
|
||||||
parser.allow_abbrev = False
|
parser.allow_abbrev = False
|
||||||
|
@ -156,8 +156,7 @@ def get_parser():
|
|||||||
''' Creates :py:class:`argparse.ArgumentParser` suitable for
|
''' Creates :py:class:`argparse.ArgumentParser` suitable for
|
||||||
:program:`qvm-pool`.
|
:program:`qvm-pool`.
|
||||||
'''
|
'''
|
||||||
parser = qubesadmin.tools.QubesArgumentParser(description=__doc__,
|
parser = qubesadmin.tools.QubesArgumentParser(description=__doc__)
|
||||||
want_app=True)
|
|
||||||
parser.register('action', 'parsers',
|
parser.register('action', 'parsers',
|
||||||
qubesadmin.tools.AliasedSubParsersAction)
|
qubesadmin.tools.AliasedSubParsersAction)
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ from qubesadmin.tools import QubesArgumentParser
|
|||||||
import qubesadmin.utils
|
import qubesadmin.utils
|
||||||
|
|
||||||
parser = QubesArgumentParser(description=__doc__,
|
parser = QubesArgumentParser(description=__doc__,
|
||||||
want_app=True,
|
|
||||||
vmname_nargs='+')
|
vmname_nargs='+')
|
||||||
parser.add_argument("--force", "-f", action="store_true", dest="no_confirm",
|
parser.add_argument("--force", "-f", action="store_true", dest="no_confirm",
|
||||||
default=False, help="Do not prompt for confirmation")
|
default=False, help="Do not prompt for confirmation")
|
||||||
|
@ -323,8 +323,7 @@ def get_parser():
|
|||||||
'''Create :py:class:`argparse.ArgumentParser` suitable for
|
'''Create :py:class:`argparse.ArgumentParser` suitable for
|
||||||
:program:`qvm-volume`.
|
:program:`qvm-volume`.
|
||||||
'''
|
'''
|
||||||
parser = qubesadmin.tools.QubesArgumentParser(description=__doc__,
|
parser = qubesadmin.tools.QubesArgumentParser(description=__doc__)
|
||||||
want_app=True)
|
|
||||||
parser.register('action', 'parsers',
|
parser.register('action', 'parsers',
|
||||||
qubesadmin.tools.AliasedSubParsersAction)
|
qubesadmin.tools.AliasedSubParsersAction)
|
||||||
sub_parsers = parser.add_subparsers(
|
sub_parsers = parser.add_subparsers(
|
||||||
|
Loading…
Reference in New Issue
Block a user