invoke-toolkit 0.0.71__tar.gz → 0.0.72__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/PKG-INFO +1 -1
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/program/program.py +40 -2
- invoke_toolkit-0.0.72/tests/test_task_suggestions.py +120 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/.gitignore +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/LICENSE.txt +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/README.md +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/pyproject.toml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/__main__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/collections.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/completion.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/config/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/config/config.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/config/registry.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/config/schema.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/config/status_helper.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/context/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/context/async_tools.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/context/context.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/context/types.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/executor.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/config.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/create.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/dist.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/plugin.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/shell.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/uv_tools.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/field_resolvers.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/loader/entrypoint.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/log/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/log/logger.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/output/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/output/console.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/output/utils.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/parser.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/program/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/program/main.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/py.typed +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/runners/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/runners/rich.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/scripts/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/scripts/loader.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/tasks/autocomplete.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/tasks/cache.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/tasks/fields.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/tasks/fields.pyi +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/tasks/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/tasks/types.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/testing.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/utils/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/utils/fzf.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/utils/inspection.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/utils/singleton.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/utils/text.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/package-template/.gitignore.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/package-template/README.md.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/package-template/copier.yml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/package-template/pyproject.toml.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/package-template/src/{{package_slug}}/__init__.py.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/package-template/src/{{package_slug}}/tasks.py.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/.gitignore.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/README.md.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/copier.yml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/pyproject.toml.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/src/{{package_slug}}/__init__.py.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/tests/test_resolver.py.jinja +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/conftest.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/cached_completion/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/completion_with_config/.gitignore +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/completion_with_config/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/config_schema/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/enum_select_size/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/fzf_selector/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/literal_set_level/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/local_field_resolver/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/local_tasks/local_tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/local_tasks/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/extensions/conftest.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/extensions/test_config_tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/extensions/test_create.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/extensions/test_package_template_entrypoint.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/extensions/test_shell_tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/extensions/test_uv_plugins.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/fixtures/future_fields.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/integration/pty_plugin_completion.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/integration/uv_tool_plugins.sh +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/all-four/invoke.json +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/all-four/invoke.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/all-four/invoke.yml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/collection.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/echo.yaml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/json/invoke.json +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/json-and-python/invoke.json +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/json-and-python/invoke.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/no-dedupe.yaml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/no-echo.yaml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/package/invoke.yml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/package/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/python/invoke.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/runtime.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/three-of-em/invoke.json +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/three-of-em/invoke.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/three-of-em/invoke.yml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/underscores/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/yaml/explicit.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/yaml/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/yml/explicit.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/yml/invoke.yml +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/yml/tasks.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/has_modules.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/conftest.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/test_config.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/program/main.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/program/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/program/tasks/coll1.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/script/test_script.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/tasks/test_cache.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/tasks/test_extensions_config.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_alias_self_reference.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_annotated_help.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_async_edge_cases.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_async_support.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_cofig_class.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_collection.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_collection_configure.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_completion_with_choices.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_config_helper.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_config_registry.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_config_schema.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_console.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_context_class.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_disable_status_cli.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_enum_arguments.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_executor.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_field_typing.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_fields.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_file_completion.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_global_context.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_help_flags.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_invoke_3_compat.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_invoke_compatibility.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_list_filter_flags.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_loader.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_parsing.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_proctitle.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_program_with_collection.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_pty_stdin.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_release_guard.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/test_toplevel.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/typecheck/fields.py +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/typecheck/fields_negative.py.fixture +0 -0
- {invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/utils/test_fzf.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: invoke-toolkit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.72
|
|
4
4
|
Summary: Extended APIs for PyInvoke: composable task plugins, typed CLI args, Rich output, shell completion, and PEP 723 script support
|
|
5
5
|
Project-URL: Documentation, https://github.com/D3f0/invoke-toolkit#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/D3f0/invoke-toolkit/issues
|
|
@@ -12,12 +12,13 @@ import inspect
|
|
|
12
12
|
import os
|
|
13
13
|
import re
|
|
14
14
|
import sys
|
|
15
|
+
from collections.abc import Iterator, Sequence
|
|
16
|
+
from difflib import get_close_matches
|
|
15
17
|
from importlib import import_module, metadata
|
|
16
18
|
from importlib.util import module_from_spec
|
|
17
19
|
from logging import getLogger
|
|
18
20
|
from pathlib import Path
|
|
19
21
|
from typing import Any, Literal
|
|
20
|
-
from collections.abc import Iterator, Sequence
|
|
21
22
|
|
|
22
23
|
from rich.table import Table
|
|
23
24
|
|
|
@@ -297,6 +298,43 @@ class ToolkitProgram(Program):
|
|
|
297
298
|
self.collection, # type: ignore
|
|
298
299
|
)
|
|
299
300
|
|
|
301
|
+
def _suggestion_names(self) -> list[str]:
|
|
302
|
+
"""Return runnable task names, aliases, and collection paths."""
|
|
303
|
+
task_names = self.collection.task_names
|
|
304
|
+
names = [
|
|
305
|
+
*task_names,
|
|
306
|
+
*(alias for aliases in task_names.values() for alias in aliases),
|
|
307
|
+
]
|
|
308
|
+
pending = [("", self.collection)]
|
|
309
|
+
while pending:
|
|
310
|
+
prefix, collection = pending.pop()
|
|
311
|
+
for name, child in collection.collections.items():
|
|
312
|
+
qualified_name = f"{prefix}.{name}" if prefix else name
|
|
313
|
+
names.append(qualified_name)
|
|
314
|
+
pending.append((qualified_name, child))
|
|
315
|
+
return names
|
|
316
|
+
|
|
317
|
+
def _unknown_task_error(self, task_name: str) -> ParseError:
|
|
318
|
+
"""Build an unknown-task error with nearby task and collection names."""
|
|
319
|
+
error = f"No idea what '{task_name}' is!"
|
|
320
|
+
suggestions = get_close_matches(
|
|
321
|
+
task_name, self._suggestion_names(), n=3, cutoff=0.6
|
|
322
|
+
)
|
|
323
|
+
if not suggestions:
|
|
324
|
+
return ParseError(error)
|
|
325
|
+
suggestion = ", ".join(f"'{name}'" for name in suggestions)
|
|
326
|
+
return ParseError(f"{error} Did you mean {suggestion}?")
|
|
327
|
+
|
|
328
|
+
def parse_tasks(self) -> None:
|
|
329
|
+
"""Parse tasks and suggest close names for unknown task tokens."""
|
|
330
|
+
try:
|
|
331
|
+
super().parse_tasks()
|
|
332
|
+
except ParseError as error:
|
|
333
|
+
match = re.fullmatch(r"No idea what '([^']+)' is!", str(error))
|
|
334
|
+
if not match:
|
|
335
|
+
raise
|
|
336
|
+
raise self._unknown_task_error(match.group(1)) from error
|
|
337
|
+
|
|
300
338
|
def print_columns(self, tuples, col_count: int | None = 2):
|
|
301
339
|
print = get_console("out").print
|
|
302
340
|
|
|
@@ -689,7 +727,7 @@ class ToolkitProgram(Program):
|
|
|
689
727
|
else:
|
|
690
728
|
# TODO: feels real dumb to factor this out of Parser, but...we
|
|
691
729
|
# should?
|
|
692
|
-
raise
|
|
730
|
+
raise self._unknown_task_error(halp)
|
|
693
731
|
|
|
694
732
|
# Handle --list / --list-tasks / --list-plugins (raises Exit if triggered)
|
|
695
733
|
self._handle_list_flags()
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from typing import Any, cast
|
|
2
|
+
|
|
3
|
+
from invoke.tasks import Task
|
|
4
|
+
from invoke_toolkit import task
|
|
5
|
+
from invoke_toolkit.collections import ToolkitCollection
|
|
6
|
+
from invoke_toolkit.testing import TestingToolkitProgram
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def collection(*tasks, name: str | None = None) -> ToolkitCollection:
|
|
10
|
+
namespace = ToolkitCollection(name) if name else ToolkitCollection()
|
|
11
|
+
for decorated_task in tasks:
|
|
12
|
+
namespace.add_task(cast(Task[Any], decorated_task))
|
|
13
|
+
return namespace
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def root_with(*collections: ToolkitCollection) -> ToolkitCollection:
|
|
17
|
+
namespace = ToolkitCollection()
|
|
18
|
+
for child in collections:
|
|
19
|
+
namespace.add_collection(child)
|
|
20
|
+
return namespace
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
MISSPELLED_BUILD = "build".replace("l", "")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_unknown_task_suggests_close_task_name(capsys):
|
|
27
|
+
@task
|
|
28
|
+
def build(ctx):
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
program = TestingToolkitProgram(namespace=collection(build))
|
|
32
|
+
program.run(["", MISSPELLED_BUILD], exit=False)
|
|
33
|
+
output = capsys.readouterr().err
|
|
34
|
+
|
|
35
|
+
assert f"No idea what '{MISSPELLED_BUILD}' is!" in output
|
|
36
|
+
assert "Did you mean 'build'?" in output
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_unknown_task_does_not_suggest_distant_task(capsys):
|
|
40
|
+
@task
|
|
41
|
+
def build(ctx):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
program = TestingToolkitProgram(namespace=collection(build))
|
|
45
|
+
program.run(["", "deploy"], exit=False)
|
|
46
|
+
output = capsys.readouterr().err
|
|
47
|
+
|
|
48
|
+
assert "No idea what 'deploy' is!" in output
|
|
49
|
+
assert "Did you mean" not in output
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_unknown_nested_task_suggests_full_task_name(capsys):
|
|
53
|
+
@task
|
|
54
|
+
def build(ctx):
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
tools = collection(build, name="tools")
|
|
58
|
+
program = TestingToolkitProgram(namespace=root_with(tools))
|
|
59
|
+
program.run(["", f"tools.{MISSPELLED_BUILD}"], exit=False)
|
|
60
|
+
output = capsys.readouterr().err
|
|
61
|
+
|
|
62
|
+
assert f"No idea what 'tools.{MISSPELLED_BUILD}' is!" in output
|
|
63
|
+
assert "Did you mean" in output
|
|
64
|
+
assert "'tools.build'" in output
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_unknown_collection_suggests_close_collection_name(capsys):
|
|
68
|
+
@task
|
|
69
|
+
def build(ctx):
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
tools = collection(build, name="tools")
|
|
73
|
+
program = TestingToolkitProgram(namespace=root_with(tools))
|
|
74
|
+
program.run(["", "tolos"], exit=False)
|
|
75
|
+
output = capsys.readouterr().err
|
|
76
|
+
|
|
77
|
+
assert "No idea what 'tolos' is!" in output
|
|
78
|
+
assert "Did you mean 'tools'?" in output
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_unknown_nested_collection_suggests_full_collection_name(capsys):
|
|
82
|
+
@task
|
|
83
|
+
def deploy(ctx):
|
|
84
|
+
pass
|
|
85
|
+
|
|
86
|
+
aws = collection(deploy, name="aws")
|
|
87
|
+
plugins = root_with(aws)
|
|
88
|
+
plugins.name = "plugins"
|
|
89
|
+
program = TestingToolkitProgram(namespace=root_with(plugins))
|
|
90
|
+
program.run(["", "plugins.awz"], exit=False)
|
|
91
|
+
output = capsys.readouterr().err
|
|
92
|
+
|
|
93
|
+
assert "No idea what 'plugins.awz' is!" in output
|
|
94
|
+
assert "'plugins.aws'" in output
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def test_unknown_task_alias_suggests_close_alias(capsys):
|
|
98
|
+
@task(aliases=["compile"])
|
|
99
|
+
def build(ctx):
|
|
100
|
+
pass
|
|
101
|
+
|
|
102
|
+
program = TestingToolkitProgram(namespace=collection(build))
|
|
103
|
+
program.run(["", "compiel"], exit=False)
|
|
104
|
+
output = capsys.readouterr().err
|
|
105
|
+
|
|
106
|
+
assert "No idea what 'compiel' is!" in output
|
|
107
|
+
assert "'compile'" in output
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_unknown_help_task_suggests_close_task_name(capsys):
|
|
111
|
+
@task
|
|
112
|
+
def build(ctx):
|
|
113
|
+
pass
|
|
114
|
+
|
|
115
|
+
program = TestingToolkitProgram(namespace=collection(build))
|
|
116
|
+
program.run(["", "--help", MISSPELLED_BUILD], exit=False)
|
|
117
|
+
output = capsys.readouterr().err
|
|
118
|
+
|
|
119
|
+
assert f"No idea what '{MISSPELLED_BUILD}' is!" in output
|
|
120
|
+
assert "Did you mean 'build'?" in output
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/__init__.py
RENAMED
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/config.py
RENAMED
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/create.py
RENAMED
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/plugin.py
RENAMED
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/src/invoke_toolkit/extensions/tasks/shell.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/package-template/pyproject.toml.jinja
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/.gitignore.jinja
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/templates/provider-template/pyproject.toml.jinja
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/completion_with_config/.gitignore
RENAMED
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/completion_with_config/tasks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/examples/local_field_resolver/tasks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/extensions/test_package_template_entrypoint.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/collection.py
RENAMED
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/echo.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/no-echo.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/runtime.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/yaml/tasks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/configs/yml/tasks.py
RENAMED
|
File without changes
|
{invoke_toolkit-0.0.71 → invoke_toolkit-0.0.72}/tests/original_invoke/_support/has_modules.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|