Explicitly fail if dict is missing.
This commit is contained in:
parent
8b753bde26
commit
b164f089d6
|
@ -284,7 +284,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."
|
||||
)
|
||||
|
@ -296,6 +296,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()
|
||||
|
@ -333,7 +336,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())
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue