Skip to content

Commit 3fc34a8

Browse files
authored
Print help message when p option is missing
2 parents d728222 + b40f692 commit 3fc34a8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/fosslight_source/convert_scancode.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def main():
103103
global logger
104104

105105
argv = sys.argv[1:]
106-
path_to_find_bin = os.getcwd()
106+
path_to_find_json = ""
107107
start_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
108108
output_file_name = ""
109109
print_matched_text = False
@@ -114,14 +114,17 @@ def main():
114114
if opt == "-h":
115115
print_help_msg_convert()
116116
elif opt == "-p":
117-
path_to_find_bin = arg
117+
path_to_find_json = arg
118118
elif opt == "-o":
119119
output_file_name = arg
120120
elif opt == "-m":
121121
print_matched_text = True
122122
except Exception:
123123
print_help_msg_convert()
124124

125+
if path_to_find_json == "":
126+
print_help_msg_convert()
127+
125128
if output_file_name == "":
126129
output_dir = os.getcwd()
127130
oss_report_name = "FOSSLight-Report_" + start_time
@@ -131,7 +134,7 @@ def main():
131134

132135
logger, _result_log = init_log(os.path.join(output_dir, "fosslight_src_log_" + start_time + ".txt"),
133136
True, logging.INFO, logging.DEBUG, _PKG_NAME)
134-
convert_json_to_excel(path_to_find_bin, oss_report_name, _result_log, print_matched_text)
137+
convert_json_to_excel(path_to_find_json, oss_report_name, _result_log, print_matched_text)
135138

136139

137140
if __name__ == '__main__':

0 commit comments

Comments
 (0)