Skip to content

Commit f8e339c

Browse files
authored
Merge pull request #198 from fosslight/develop
Print option name with error msg
2 parents 7722d35 + abfa496 commit f8e339c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/fosslight_util/output_format.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def check_output_format(output='', format='', customized_format={}):
3131
format = format.lower()
3232
if format not in list(support_format.keys()):
3333
success = False
34-
msg = 'Enter the supported format with -f option: ' + ', '.join(list(support_format.keys()))
34+
msg = '(-f option) Enter the supported format: ' + ', '.join(list(support_format.keys()))
3535
else:
3636
output_extension = support_format[format]
3737

@@ -47,11 +47,11 @@ def check_output_format(output='', format='', customized_format={}):
4747
if format:
4848
if output_extension != basename_extension:
4949
success = False
50-
msg = f"Enter the same extension of output file(-o:'{output}') with format(-f:'{format}')."
50+
msg = f"(-o & -f option) Enter the same extension of output file(-o:'{output}') with format(-f:'{format}')."
5151
else:
5252
if basename_extension not in support_format.values():
5353
success = False
54-
msg = 'Enter the supported file extension: ' + ', '.join(list(support_format.values()))
54+
msg = '(-o option) Enter the supported file extension: ' + ', '.join(list(support_format.values()))
5555
if success:
5656
output_file = basename_file
5757
output_extension = basename_extension
@@ -79,7 +79,7 @@ def check_output_formats(output='', formats=[], customized_format={}):
7979
for format in formats:
8080
if format not in list(support_format.keys()):
8181
success = False
82-
msg = 'Enter the supported format with -f option: ' + ', '.join(list(support_format.keys()))
82+
msg = '(-f option) Enter the supported format: ' + ', '.join(list(support_format.keys()))
8383
else:
8484
output_extensions.append(support_format[format])
8585

@@ -95,11 +95,11 @@ def check_output_formats(output='', formats=[], customized_format={}):
9595
if formats:
9696
if basename_extension not in output_extensions:
9797
success = False
98-
msg = f"The format of output file(-o:'{output}') should be in the format list(-f:'{formats}')."
98+
msg = f"(-o & -f option) The format of output file(-o:'{output}') should be in the format list(-f:'{formats}')."
9999
else:
100100
if basename_extension not in support_format.values():
101101
success = False
102-
msg = 'Enter the supported file extension: ' + ', '.join(list(support_format.values()))
102+
msg = '(-o option) Enter the supported file extension: ' + ', '.join(list(support_format.values()))
103103
output_extensions.append(basename_extension)
104104
output_files = [basename_file for _ in range(len(output_extensions))]
105105
else:
@@ -128,7 +128,7 @@ def check_output_formats_v2(output='', formats=[], customized_format={}):
128128
for format in formats:
129129
if format not in list(support_format.keys()):
130130
success = False
131-
msg = 'Enter the supported format with -f option: ' + ', '.join(list(support_format.keys()))
131+
msg = '(-f option) Enter the supported format with -f option: ' + ', '.join(list(support_format.keys()))
132132
else:
133133
output_extensions.append(support_format[format])
134134

@@ -144,11 +144,11 @@ def check_output_formats_v2(output='', formats=[], customized_format={}):
144144
if formats:
145145
if basename_extension not in output_extensions:
146146
success = False
147-
msg = f"The format of output file(-o:'{output}') should be in the format list(-f:'{formats}')."
147+
msg = f"(-o & -f option) The format of output file(-o:'{output}') should be in the format list(-f:'{formats}')."
148148
else:
149149
if basename_extension not in support_format.values():
150150
success = False
151-
msg = 'Enter the supported file extension: ' + ', '.join(list(support_format.values()))
151+
msg = '(-o option) Enter the supported file extension: ' + ', '.join(list(support_format.values()))
152152
output_extensions.append(basename_extension)
153153
output_files = [basename_file for _ in range(len(output_extensions))]
154154
else:
@@ -199,6 +199,6 @@ def write_output_file(output_file_without_ext: str, file_extension: str, scan_it
199199
success, msg, result_file = write_yaml(result_file, scan_item, False)
200200
else:
201201
success = False
202-
msg = f'Not supported file extension({file_extension})'
202+
msg = f'(-f option) Not supported file extension({file_extension})'
203203

204204
return success, msg, result_file

0 commit comments

Comments
 (0)