dirigent-cli 0.9.0__py3-none-any.whl
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.
- dirigent_cli/__init__.py +5 -0
- dirigent_cli/aliases.py +41 -0
- dirigent_cli/commands.py +2525 -0
- dirigent_cli/context.py +136 -0
- dirigent_cli/formatters.py +158 -0
- dirigent_cli/graph.py +109 -0
- dirigent_cli/health.py +294 -0
- dirigent_cli/local.py +790 -0
- dirigent_cli/main.py +1169 -0
- dirigent_cli/output.py +543 -0
- dirigent_cli/params.py +389 -0
- dirigent_cli/profiles.py +221 -0
- dirigent_cli/project.py +643 -0
- dirigent_cli/py.typed +0 -0
- dirigent_cli/reaper.py +115 -0
- dirigent_cli/scaffold.py +63 -0
- dirigent_cli/schemas.py +85 -0
- dirigent_cli/sources.py +76 -0
- dirigent_cli/stream.py +180 -0
- dirigent_cli/summaries.py +420 -0
- dirigent_cli/templates/pack/README.md.tmpl +23 -0
- dirigent_cli/templates/pack/__init__.py.tmpl +24 -0
- dirigent_cli/templates/pack/operator.py.tmpl +34 -0
- dirigent_cli/templates/pack/pyproject.toml.tmpl +21 -0
- dirigent_cli/templates/pack/test_plugin.py.tmpl +21 -0
- dirigent_cli/timing.py +322 -0
- dirigent_cli/triggers.py +631 -0
- dirigent_cli-0.9.0.dist-info/METADATA +24 -0
- dirigent_cli-0.9.0.dist-info/RECORD +32 -0
- dirigent_cli-0.9.0.dist-info/WHEEL +4 -0
- dirigent_cli-0.9.0.dist-info/entry_points.txt +4 -0
- dirigent_cli-0.9.0.dist-info/licenses/LICENSE +18 -0
dirigent_cli/__init__.py
ADDED
dirigent_cli/aliases.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Hidden aliases: ``ls`` for every ``list`` in the tree, and one for a single command."""
|
|
2
|
+
|
|
3
|
+
from typing import Final
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
LIST_COMMAND: Final = "list"
|
|
8
|
+
LIST_ALIAS: Final = "ls"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def add_list_aliases(app: typer.Typer, *, alias: str = LIST_ALIAS) -> list[str]:
|
|
12
|
+
"""Register a hidden ``ls`` beside every ``list`` in an app and its groups.
|
|
13
|
+
|
|
14
|
+
Call after the whole tree is assembled; commands registered later are not walked.
|
|
15
|
+
"""
|
|
16
|
+
aliased: list[str] = []
|
|
17
|
+
for group in app.registered_groups:
|
|
18
|
+
inner = group.typer_instance
|
|
19
|
+
if inner is not None:
|
|
20
|
+
aliased.extend(
|
|
21
|
+
f"{group.name or inner.info.name or '?'} {name}" for name in add_list_aliases(inner, alias=alias)
|
|
22
|
+
)
|
|
23
|
+
if any(command.name == alias for command in app.registered_commands):
|
|
24
|
+
return aliased
|
|
25
|
+
for command in list(app.registered_commands):
|
|
26
|
+
if command.name != LIST_COMMAND or command.callback is None:
|
|
27
|
+
continue
|
|
28
|
+
app.command(alias, hidden=True, help=command.help)(command.callback)
|
|
29
|
+
aliased.append(alias)
|
|
30
|
+
return aliased
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def add_alias(app: typer.Typer, name: str, alias: str, *, hidden: bool = True) -> None:
|
|
34
|
+
"""Register a second name for one command, so muscle memory from another tool still lands."""
|
|
35
|
+
for command in list(app.registered_commands):
|
|
36
|
+
# A command registered without a name is named after its function, as typer does it.
|
|
37
|
+
called = command.callback
|
|
38
|
+
if called is not None and name in (command.name, called.__name__):
|
|
39
|
+
app.command(alias, hidden=hidden, help=command.help)(called)
|
|
40
|
+
return
|
|
41
|
+
raise LookupError(f"no command named {name!r} to alias")
|