[elbe-devel] [PATCH 2/2] commands: cyclonedx-sbom: validate options

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jul 8 12:21:41 CEST 2024


In case invalid options are provided, print an error message.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/commands/cyclonedx-sbom.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/elbepack/commands/cyclonedx-sbom.py b/elbepack/commands/cyclonedx-sbom.py
index 431696e09816..63007f33fa6c 100644
--- a/elbepack/commands/cyclonedx-sbom.py
+++ b/elbepack/commands/cyclonedx-sbom.py
@@ -86,6 +86,11 @@ def run_command(argv):
     oparser.add_option('-d', dest='elbe_build')
     options, args = oparser.parse_args(argv)
 
+    if args != [] or options.elbe_build is None:
+        print('invalid options')
+        oparser.print_help()
+        sys.exit(1)
+
     ts = datetime.datetime.now(tz=datetime.timezone.utc)
     project_dir = options.elbe_build
     source_file = ElbeXML(os.path.join(project_dir, 'source.xml'))

-- 
2.45.2



More information about the elbe-devel mailing list