Skip to content

Commit 9fca2cf

Browse files
committed
Add FOSSLight Convert help message
1 parent df14a29 commit 9fca2cf

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

src/fosslight_source/convert_scancode.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import yaml
1717
from ._parsing_scancode_file_item import parsing_file_item
1818
from fosslight_util.write_excel import write_excel_and_csv
19+
from .help import print_help_msg_convert
1920

2021
logger = logging.getLogger(constant.LOGGER_NAME)
2122
_PKG_NAME = "fosslight_source"
@@ -88,11 +89,6 @@ def get_detected_licenses_from_scancode(scancode_json_file):
8889
return file_list
8990

9091

91-
def print_help_msg():
92-
print("* Required :\n -p path_of_scancode_json_result")
93-
sys.exit()
94-
95-
9692
def main():
9793
global logger
9894

@@ -105,7 +101,7 @@ def main():
105101
opts, args = getopt.getopt(argv, 'hp:o:')
106102
for opt, arg in opts:
107103
if opt == "-h":
108-
print_help_msg()
104+
print_help_msg_convert()
109105
elif opt == "-p":
110106
path_to_find_bin = arg
111107
elif opt == "-o":

src/fosslight_source/help.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,21 @@
2020
-j\t\t\t\t Generate additional result of executing ScanCode in json format
2121
-o <file_name>\t\t Output file name"""
2222

23+
_HELP_MESSAGE_CONVERT = """
24+
Usage: fosslight_convert [option1] <arg1> [option2] <arg2>...
2325
24-
def print_help_msg():
26+
FOSSLigtht_convert converts the result of executing ScanCode in json format into OSS Report format.
27+
28+
Options:
29+
-h\t\t\t\t Print help message
30+
-p <path_dir>\t\t Path of ScanCode json files
31+
-o <file_name>\t\t Output file name"""
32+
33+
34+
def print_help_msg_source():
2535
helpMsg = PrintHelpMsg(_HELP_MESSAGE_SOURCE)
36+
helpMsg.print_help_msg(True)
37+
38+
def print_help_msg_convert():
39+
helpMsg = PrintHelpMsg(_HELP_MESSAGE_CONVERT)
2640
helpMsg.print_help_msg(True)

src/fosslight_source/run_scancode.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from fosslight_util.timer_thread import TimerThread
2020
from ._parsing_scancode_file_item import parsing_file_item
2121
from fosslight_util.write_excel import write_excel_and_csv
22-
from .help import print_help_msg
22+
from .help import print_help_msg_source
2323

2424
logger = logging.getLogger(constant.LOGGER_NAME)
2525
warnings.filterwarnings("ignore", category=FutureWarning)
@@ -37,7 +37,7 @@ def main():
3737
opts, args = getopt.getopt(argv, 'hjp:o:')
3838
for opt, arg in opts:
3939
if opt == "-h":
40-
print_help_msg()
40+
print_help_msg_source()
4141
elif opt == "-p":
4242
_path_to_scan = arg
4343
elif opt == "-j":
@@ -46,7 +46,7 @@ def main():
4646
_output_file = arg
4747

4848
except Exception:
49-
print_help_msg()
49+
print_help_msg_source()
5050

5151
timer = TimerThread()
5252
timer.setDaemon(True)
@@ -83,7 +83,7 @@ def run_scan(path_to_scan, output_file_name="",
8383
if _windows:
8484
path_to_scan = os.getcwd()
8585
else:
86-
print_help_msg()
86+
print_help_msg_source()
8787

8888
num_cores = multiprocessing.cpu_count() - 1 if num_cores < 0 else num_cores
8989

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ setenv =
1313

1414
commands =
1515
fosslight_source -h
16+
fosslight_convert -h
1617
fosslight_source -p test -j -o test_scan/scan_result
1718
cat test_scan/scan_result.csv
1819
fosslight_convert -p test_scan/scan_result.json -o test_convert/convert_result

0 commit comments

Comments
 (0)