diff mbox series

[yocto-autobuilder-helper,v2,3/7] scripts/yocto-supported-distros: configure mutually exclusive argparse groups

Message ID 20250806-check-worker-statuses-v2-3-59dd990d22e7@bootlin.com
State New
Headers show
Series scripts/yocto-supported-distros improvements | expand

Commit Message

Antonin Godard Aug. 6, 2025, 3:43 p.m. UTC
Some options cannot be used with others. Make them mutually exclusive.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 scripts/yocto-supported-distros | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/scripts/yocto-supported-distros b/scripts/yocto-supported-distros
index 81f881f..e259e1a 100755
--- a/scripts/yocto-supported-distros
+++ b/scripts/yocto-supported-distros
@@ -59,29 +59,33 @@  AUTOBUILDER_WORKERS_ENDPOINT = "https://autobuilder.yoctoproject.org/valkyrie/ap
 def parse_arguments() -> argparse.Namespace:
     parser = argparse.ArgumentParser(description="Print supported distributions")
 
-    parser.add_argument("--releases",
-                        type=str,
-                        nargs='+',
-                        default=[],
-                        help="Yocto releases")
-
-    parser.add_argument("--config",
-                        type=Path,
-                        default=None,
-                        help="Autobuilder config.py input file")
-
-    parser.add_argument("--release-from-env",
-                        action="store_true",
-                        help="Get the release codename from the bitbake environment")
+    g1 = parser.add_mutually_exclusive_group()
+
+    g1.add_argument("--releases",
+                    type=str,
+                    nargs='+',
+                    default=[],
+                    help="Yocto releases")
+
+    g1.add_argument("--release-from-env",
+                    action="store_true",
+                    help="Get the release codename from the bitbake environment")
+
+    g2 = parser.add_mutually_exclusive_group()
+
+    g2.add_argument("--config",
+                    type=Path,
+                    default=None,
+                    help="Autobuilder config.py input file")
+
+    g2.add_argument("--config-from-web",
+                    action="store_true",
+                    help="Get config.py from yoctoproject's git web interface")
 
     parser.add_argument("--compare",
                         action="store_true",
                         help="Compare to poky.conf releases")
 
-    parser.add_argument("--config-from-web",
-                        action="store_true",
-                        help="Get config.py from yoctoproject's git web interface")
-
     parser.add_argument("--check-worker-statuses",
                         action="store_true",
                         default=False,