Add CLI registry (#6037)

This commit is contained in:
Matthew Honnibal 2020-09-08 15:23:34 +02:00 committed by GitHub
parent d98ae9d918
commit b470062153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -13,7 +13,7 @@ from thinc.config import Config, ConfigValidationError
from configparser import InterpolationError
from ..schemas import ProjectConfigSchema, validate
from ..util import import_file, run_command, make_tempdir
from ..util import import_file, run_command, make_tempdir, registry
if TYPE_CHECKING:
from pathy import Pathy # noqa: F401
@ -54,6 +54,8 @@ app.add_typer(init_cli)
def setup_cli() -> None:
# Make sure the entry-point for CLI runs, so that they get imported.
registry.cli.get_all()
# Ensure that the help messages always display the correct prompt
command = get_command(app)
command(prog_name=COMMAND)

View File

@ -93,6 +93,7 @@ class registry(thinc.registry):
# environment. spaCy models packaged with `spacy package` will "advertise"
# themselves via entry points.
models = catalogue.create("spacy", "models", entry_points=True)
cli = catalogue.create("spacy", "cli", entry_points=True)
class SimpleFrozenDict(dict):