From 10bea1b77e15429120f726aa1ca384d1439254ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 4 Feb 2021 17:04:48 +0100 Subject: [PATCH] qvm-template: allow global arguments after action name It's convenient to use for example `qvm-template list --enablerepo=*-testing` Previously, _some_ options needed to be before action name. --- qubesadmin/tools/qvm_template.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qubesadmin/tools/qvm_template.py b/qubesadmin/tools/qvm_template.py index f63e267..731ea16 100644 --- a/qubesadmin/tools/qvm_template.py +++ b/qubesadmin/tools/qvm_template.py @@ -1414,7 +1414,9 @@ def main(args: typing.Optional[typing.Sequence[str]] = None, :return: Return code of the application """ - p_args = parser.parse_args(args) + # do two passes to allow global options after command name too + p_args, args = parser.parse_known_args(args) + p_args = parser.parse_args(args, p_args) if not p_args.command: parser.error('A command needs to be specified.')