Skip to content

Commit cbbb791

Browse files
committed
Add parameter for scancode cores
1 parent a71b7e0 commit cbbb791

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/fosslight_source/cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def main():
5151
scanned_result = []
5252
license_list = []
5353
time_out = 120
54+
core = -1
5455

5556
parser = argparse.ArgumentParser(description='FOSSLight Source', prog='fosslight_source', add_help=False)
5657
parser.add_argument('-h', '--help', action='store_true', required=False)
@@ -62,6 +63,8 @@ def main():
6263
parser.add_argument('-f', '--format', nargs=1, type=str, required=False)
6364
parser.add_argument('-s', '--scanner', nargs=1, type=str, required=False, default='all')
6465
parser.add_argument('-t', '--timeout', type=int, required=False, default=120)
66+
parser.add_argument('-c', '--cores', type=int, required=False, default=-1)
67+
6568

6669
args = parser.parse_args()
6770

@@ -84,6 +87,7 @@ def main():
8487
selected_scanner = ''.join(args.scanner)
8588

8689
time_out = args.timeout
90+
core = args.cores
8791

8892
timer = TimerThread()
8993
timer.setDaemon(True)
@@ -103,14 +107,14 @@ def main():
103107
if os.path.isdir(path_to_scan):
104108
if selected_scanner == 'scancode':
105109
success, _result_log["Scan Result"], scanned_result, license_list = run_scan(path_to_scan, output_file_name,
106-
write_json_file, -1, True,
110+
write_json_file, core, True,
107111
print_matched_text, format, True,
108112
time_out)
109113
elif selected_scanner == 'scanoss':
110114
scanned_result = run_scanoss_py(path_to_scan, output_file_name, format, True, write_json_file)
111115
elif selected_scanner == 'all' or selected_scanner == '':
112116
success, _result_log["Scan Result"], scanned_result, license_list = run_all_scanners(path_to_scan, output_file_name,
113-
write_json_file, -1,
117+
write_json_file, core,
114118
print_matched_text, format, True,
115119
time_out)
116120
else:

0 commit comments

Comments
 (0)