@@ -352,48 +352,58 @@ def run_main(mode, path_arg, dep_arguments, output_file_or_dir, file_format, url
352352 run_dep = False
353353 run_prechecker = False
354354 remove_downloaded_source = False
355-
356- if mode == "prechecker" or mode == "reuse" :
357- run_prechecker = True
358- elif mode == "binary" or mode == "bin" :
359- run_bin = True
360- elif mode == "source" or mode == "src" :
361- run_src = True
362- elif mode == "dependency" or mode == "dep" :
363- run_dep = True
364- else :
355+ mode_list = []
356+ if mode :
357+ mode_list = mode .split (',' )
358+ mode_list = [item .strip () for item in mode_list ]
359+
360+ if "compare" in mode_list :
361+ logger .error ("Compare mode cannot be run together with other modes." )
362+ sys .exit (1 )
363+ elif "all" in mode_list or (not mode ):
365364 run_src = True
366365 run_bin = True
367366 run_dep = True
368367 run_prechecker = True
369-
370- if src_path == "" and url_to_analyze == "" :
371- src_path , dep_arguments , url_to_analyze = get_input_mode (_executed_path , mode )
372-
373- if not hide_progressbar :
374- timer = TimerThread ()
375- timer .setDaemon (True )
376- timer .start ()
377-
378- if url_to_analyze != "" :
379- remove_downloaded_source = True
380- default_oss_name = extract_name_from_link (url_to_analyze )
381- success , src_path = download_source (url_to_analyze , output_path )
382-
383- if output_extension == ".yaml" :
384- correct_mode = False
385- correct_fpath = ""
386368 else :
387- if not correct_fpath :
388- correct_fpath = src_path
389-
390- if src_path != "" :
391- run_scanner (src_path , dep_arguments , output_path , keep_raw_data ,
392- run_src , run_bin , run_dep , run_prechecker ,
393- remove_downloaded_source , {}, output_file ,
394- output_extension , num_cores , db_url ,
395- default_oss_name , url_to_analyze ,
396- correct_mode , correct_fpath , ui_mode )
369+ if "prechecker" in mode_list or "reuse" in mode_list :
370+ run_prechecker = True
371+ if "binary" in mode_list or "bin" in mode_list :
372+ run_bin = True
373+ if "source" in mode_list or "src" in mode_list :
374+ run_src = True
375+ if "dependency" in mode_list or "dep" in mode_list :
376+ run_dep = True
377+ if run_dep or run_src or run_bin or run_prechecker :
378+ if src_path == "" and url_to_analyze == "" :
379+ src_path , dep_arguments , url_to_analyze = get_input_mode (_executed_path , mode )
380+
381+ if not hide_progressbar :
382+ timer = TimerThread ()
383+ timer .setDaemon (True )
384+ timer .start ()
385+
386+ if url_to_analyze != "" :
387+ remove_downloaded_source = True
388+ default_oss_name = extract_name_from_link (url_to_analyze )
389+ success , src_path = download_source (url_to_analyze , output_path )
390+
391+ if output_extension == ".yaml" :
392+ correct_mode = False
393+ correct_fpath = ""
394+ else :
395+ if not correct_fpath :
396+ correct_fpath = src_path
397+
398+ if src_path != "" :
399+ run_scanner (src_path , dep_arguments , output_path , keep_raw_data ,
400+ run_src , run_bin , run_dep , run_prechecker ,
401+ remove_downloaded_source , {}, output_file ,
402+ output_extension , num_cores , db_url ,
403+ default_oss_name , url_to_analyze ,
404+ correct_mode , correct_fpath , ui_mode )
405+ else :
406+ logger .error ("No mode has been selected for analysis." )
397407 try :
398408 if not keep_raw_data :
399409 logger .debug (f"Remove temporary files: { _output_dir } " )
0 commit comments