Improve command output when no files are found
This commit is contained in:
parent
d141b8bec6
commit
8a19698f38
@ -26,7 +26,7 @@ from pathlib import Path
|
||||
from typing import Generator, List, Tuple
|
||||
|
||||
import click
|
||||
from click import UsageError
|
||||
from click import ClickException
|
||||
from dennis.linter import ERROR, LintedEntry, Linter, LintMessage, LintRule, get_lint_rules
|
||||
from dennis.templatelinter import TemplateLinter
|
||||
from dennis.templatelinter import get_lint_rules as get_template_lint_rules
|
||||
@ -241,7 +241,7 @@ def run(
|
||||
files_to_check = po_files
|
||||
|
||||
if len(files_to_check) == 0:
|
||||
raise UsageError("Found no files to check.")
|
||||
raise ClickException("Found no files to check.")
|
||||
|
||||
return lint_files(files_to_check), len(files_to_check)
|
||||
|
||||
@ -250,7 +250,11 @@ def run(
|
||||
@click.option("--locale", help="Only check translations for the given locale")
|
||||
@click.argument("files", nargs=-1, type=click.Path(exists=True, resolve_path=True, path_type=Path))
|
||||
def cli(locale, files):
|
||||
"""CLI entry point."""
|
||||
"""Lint PO- and POT-files.
|
||||
|
||||
Provide one or multiple FILES to check. If omitted all files in
|
||||
the project will be checked.
|
||||
"""
|
||||
lint_results, num_checked_files = run(locale, files)
|
||||
print_results(lint_results, num_checked_files)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user