]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
mkosi: disallow parameter abbreviations
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Oct 2022 08:31:37 +0000 (10:31 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Oct 2022 08:53:05 +0000 (10:53 +0200)
For interactive use, we have both short options and tab-completion.
Abbreviated options are problematic because of forward-compatibility:
if we add more options in the future, an older abbreviation might become
non-unique and stop working.

mkosi/__init__.py

index 93005e82349f214d09ff953c4d6b04f1e131b74e..5e9474175eda0477e2521d992f8e8a4ac60da961 100644 (file)
@@ -4950,12 +4950,16 @@ class ArgumentParserMkosi(argparse.ArgumentParser):
         self._ini_file_key = ""  # multi line list processing
         self._ini_file_list_mode = False
 
+        # we need to suppress mypy here: https://github.com/python/mypy/issues/6799
         super().__init__(*kargs,
                          # Add config files to be parsed:
                          fromfile_prefix_chars=ArgumentParserMkosi.fromfile_prefix_chars,
                          formatter_class=CustomHelpFormatter,
+                         # Tweak defaults:
+                         allow_abbrev=False,
                          # Pass through the other options:
-                         **kwargs)
+                         **kwargs,
+                         ) # type: ignore
 
     @staticmethod
     def _camel_to_arg(camel: str) -> str: