Skip to content

Commit 1e3f77c

Browse files
committed
Print out unsupported modes
1 parent 9cc8a16 commit 1e3f77c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/fosslight_scanner/fosslight_scanner.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
_start_time = ""
4545
_executed_path = ""
4646
SRC_DIR_FROM_LINK_PREFIX = "fosslight_src_dir_"
47+
SCANNER_MODE = ["compare", "reuse", "prechecker", "binary", "bin", "src", "source", "dependency", "dep"]
4748

4849

4950
def run_dependency(path_to_analyze, output_file_with_path, params=""):
@@ -353,6 +354,7 @@ def run_main(mode, path_arg, dep_arguments, output_file_or_dir, file_format, url
353354
run_prechecker = False
354355
remove_downloaded_source = False
355356
mode_list = []
357+
356358
if mode:
357359
mode_list = mode.split(',')
358360
mode_list = [item.strip() for item in mode_list]
@@ -374,6 +376,11 @@ def run_main(mode, path_arg, dep_arguments, output_file_or_dir, file_format, url
374376
run_src = True
375377
if "dependency" in mode_list or "dep" in mode_list:
376378
run_dep = True
379+
mode_not_supported = list(set(mode_list).difference(SCANNER_MODE))
380+
if len(mode_not_supported) > 0:
381+
logger.error(f"An unsupported mode was entered.:{mode_not_supported}")
382+
sys.exit(1)
383+
377384
if run_dep or run_src or run_bin or run_prechecker:
378385
if src_path == "" and url_to_analyze == "":
379386
src_path, dep_arguments, url_to_analyze = get_input_mode(_executed_path, mode)

0 commit comments

Comments
 (0)