[jhbuild] jhbuild/commands: Disable interspersed args



commit 30b3b87b81a5cfc81c7449bd0c02faa1da8666f6
Author: Sebastian Wick <sebastian wick redhat com>
Date:   Fri Jan 28 13:32:13 2022 +0100

    jhbuild/commands: Disable interspersed args
    
    The option parser previously did not stop parsing options after the
    first positional argument. This would result in option parsing errors
    when trying to pass arguments to the executable passed to `jhbuild run`.
    For example `jhbuild run --in-builddir=mutter test --version` results in
    `jhbuild: error: no such option: --version`.
    
    Disable this behavior with disable_interspersed_args(). This should be
    fine to enable globally because according to the help description of all
    commands the positional arguments are always last.

 jhbuild/commands/__init__.py | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/jhbuild/commands/__init__.py b/jhbuild/commands/__init__.py
index 0d8bb993..11f7c7a5 100644
--- a/jhbuild/commands/__init__.py
+++ b/jhbuild/commands/__init__.py
@@ -59,6 +59,7 @@ class Command:
         self.parser = OptionParser(
             usage='%%prog %s %s' % (self.name, _(self.usage_args) if self.usage_args else ''),
             description=_(self.doc) if self.doc else '')
+        self.parser.disable_interspersed_args()
         self.parser.add_options(self.options)
         return self.parser.parse_args(args)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]