@@ -390,10 +390,9 @@ def parse_options(
390
390
"-D" ,
391
391
"--dictionary" ,
392
392
action = "append" ,
393
- help = "custom dictionary file that contains spelling "
394
- "corrections. If this flag is not specified or "
395
- 'equals "-" then the default dictionary is used. '
396
- "This option can be specified multiple times." ,
393
+ help = "comma-separated list of custom dictionary files that "
394
+ "contain spelling corrections. If this flag is not specified "
395
+ 'or equals "-" then the default dictionary is used.' ,
397
396
)
398
397
builtin_opts = "\n - " .join (
399
398
["" ] + [f"{ d [0 ]!r} { d [1 ]} " for d in _builtin_dictionaries ]
@@ -423,26 +422,26 @@ def parse_options(
423
422
"-I" ,
424
423
"--ignore-words" ,
425
424
action = "append" ,
426
- metavar = "FILE " ,
427
- help = "file that contains words that will be ignored "
428
- "by codespell. File must contain 1 word per line. "
429
- " Words are case sensitive based on how they are "
430
- "written in the dictionary file" ,
425
+ metavar = "FILES " ,
426
+ help = "comma-separated list of files that contain "
427
+ "words to be ignored by codespell. Files must contain "
428
+ "1 word per line. Words are case sensitive based on "
429
+ "how they are written in the dictionary file. " ,
431
430
)
432
431
parser .add_argument (
433
432
"-L" ,
434
433
"--ignore-words-list" ,
435
434
action = "append" ,
436
435
metavar = "WORDS" ,
437
- help = "comma separated list of words to be ignored "
436
+ help = "comma- separated list of words to be ignored "
438
437
"by codespell. Words are case sensitive based on "
439
- "how they are written in the dictionary file" ,
438
+ "how they are written in the dictionary file. " ,
440
439
)
441
440
parser .add_argument (
442
441
"--uri-ignore-words-list" ,
443
442
action = "append" ,
444
443
metavar = "WORDS" ,
445
- help = "comma separated list of words to be ignored "
444
+ help = "comma- separated list of words to be ignored "
446
445
"by codespell in URIs and emails only. Words are "
447
446
"case sensitive based on how they are written in "
448
447
'the dictionary file. If set to "*", all '
@@ -494,11 +493,13 @@ def parse_options(
494
493
parser .add_argument (
495
494
"-x" ,
496
495
"--exclude-file" ,
496
+ action = "append" ,
497
497
type = str ,
498
- metavar = "FILE" ,
499
- help = "ignore whole lines that match those "
500
- "in the file FILE. The lines in FILE "
501
- "should match the to-be-excluded lines exactly" ,
498
+ metavar = "FILES" ,
499
+ help = "ignore whole lines that match those in "
500
+ "the comma-separated list of files EXCLUDE. "
501
+ "The lines in these files should match the "
502
+ "to-be-excluded lines exactly" ,
502
503
)
503
504
504
505
parser .add_argument (
@@ -1166,20 +1167,22 @@ def main(*args: str) -> int:
1166
1167
else :
1167
1168
ignore_word_regex = None
1168
1169
1169
- ignore_words_files = options .ignore_words or []
1170
1170
ignore_words , ignore_words_cased = parse_ignore_words_option (
1171
1171
options .ignore_words_list
1172
1172
)
1173
-
1174
- for ignore_words_file in ignore_words_files :
1175
- if not os .path .isfile (ignore_words_file ):
1176
- print (
1177
- f"ERROR: cannot find ignore-words file: { ignore_words_file } " ,
1178
- file = sys .stderr ,
1179
- )
1180
- parser .print_help ()
1181
- return EX_USAGE
1182
- build_ignore_words (ignore_words_file , ignore_words , ignore_words_cased )
1173
+ if options .ignore_words :
1174
+ ignore_words_files = flatten_clean_comma_separated_arguments (
1175
+ options .ignore_words
1176
+ )
1177
+ for ignore_words_file in ignore_words_files :
1178
+ if not os .path .isfile (ignore_words_file ):
1179
+ print (
1180
+ f"ERROR: cannot find ignore-words file: { ignore_words_file } " ,
1181
+ file = sys .stderr ,
1182
+ )
1183
+ parser .print_help ()
1184
+ return EX_USAGE
1185
+ build_ignore_words (ignore_words_file , ignore_words , ignore_words_cased )
1183
1186
1184
1187
uri_regex = options .uri_regex or uri_regex_def
1185
1188
try :
@@ -1196,7 +1199,7 @@ def main(*args: str) -> int:
1196
1199
itertools .chain (* parse_ignore_words_option (options .uri_ignore_words_list ))
1197
1200
)
1198
1201
1199
- dictionaries = options .dictionary or ["-" ]
1202
+ dictionaries = flatten_clean_comma_separated_arguments ( options .dictionary or ["-" ])
1200
1203
1201
1204
use_dictionaries = []
1202
1205
for dictionary in dictionaries :
@@ -1258,7 +1261,9 @@ def main(*args: str) -> int:
1258
1261
1259
1262
exclude_lines : Set [str ] = set ()
1260
1263
if options .exclude_file :
1261
- build_exclude_hashes (options .exclude_file , exclude_lines )
1264
+ exclude_files = flatten_clean_comma_separated_arguments (options .exclude_file )
1265
+ for exclude_file in exclude_files :
1266
+ build_exclude_hashes (exclude_file , exclude_lines )
1262
1267
1263
1268
file_opener = FileOpener (options .hard_encoding_detection , options .quiet_level )
1264
1269
0 commit comments