Compare commits

...

3 Commits

Author SHA1 Message Date
Julien Palard 6830ff0271
Avoid a TypeError in flatten. 2023-04-17 09:52:37 +02:00
Julien Palard 446aafa72e
Oops 2023-04-11 16:11:11 +02:00
Julien Palard f3c0441cd7
Explicitly fail if dict is missing. 2023-04-10 16:58:31 +02:00
1 changed files with 5 additions and 2 deletions

View File

@ -301,7 +301,7 @@ def parse_args():
version="%(prog)s " + __version__ + " using hunspell: " + HUNSPELL_VERSION,
)
parser.add_argument("--debug", action="store_true")
parser.add_argument("-p", "--personal-dict", type=str)
parser.add_argument("-p", "--personal-dict", type=Path)
parser.add_argument(
"--modified", "-m", action="store_true", help="Use git to find modified files."
)
@ -313,6 +313,9 @@ def parse_args():
help="Number of files to check in paralel, defaults to all available CPUs",
)
args = parser.parse_args()
if args.personal_dict is not None and not args.personal_dict.exists():
print(f"Error: dictionary {str(args.personal_dict)!r} not found.")
sys.exit(1)
if args.drop_capitalized and args.no_drop_capitalized:
print("Error: don't provide both --drop-capitalized AND --no-drop-capitalized.")
parser.print_help()
@ -350,7 +353,7 @@ def run_hunspell(language, personal_dict, input_lines):
input=quote_for_hunspell(text for _, _, text in input_lines),
)
except subprocess.CalledProcessError:
return -1
return []
return parse_hunspell_output(input_lines, output.splitlines())