Skip to content

Commit

Permalink
qvm-template: allow global arguments after action name
Browse files Browse the repository at this point in the history
It's convenient to use for example
`qvm-template list --enablerepo=*-testing`
Previously, _some_ options needed to be before action name.
  • Loading branch information
marmarek committed Feb 7, 2021
1 parent e0063d8 commit 10bea1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion qubesadmin/tools/qvm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down

0 comments on commit 10bea1b

Please sign in to comment.