feat(l4d2): scaffold package and v1 CLI entrypoint
This commit is contained in:
parent
bf4d5b4f6d
commit
f2ef7e2f24
5 changed files with 75 additions and 0 deletions
1
components/l4d2-host-lib/README.md
Normal file
1
components/l4d2-host-lib/README.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# l4d2-host-lib
|
||||||
23
components/l4d2-host-lib/pyproject.toml
Normal file
23
components/l4d2-host-lib/pyproject.toml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=68", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "l4d2host"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "L4D2 host library and CLI"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.12"
|
||||||
|
dependencies = [
|
||||||
|
"typer>=0.12",
|
||||||
|
"PyYAML>=6.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
l4d2ctl = "l4d2host.cli:app"
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
package-dir = {"" = "src"}
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
where = ["src"]
|
||||||
3
components/l4d2-host-lib/src/l4d2host/__init__.py
Normal file
3
components/l4d2-host-lib/src/l4d2host/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
__all__ = ["__version__"]
|
||||||
|
|
||||||
|
__version__ = "0.1.0"
|
||||||
38
components/l4d2-host-lib/src/l4d2host/cli.py
Normal file
38
components/l4d2-host-lib/src/l4d2host/cli.py
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
import typer
|
||||||
|
|
||||||
|
|
||||||
|
app = typer.Typer(no_args_is_help=True)
|
||||||
|
|
||||||
|
|
||||||
|
def _todo() -> None:
|
||||||
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def install() -> None:
|
||||||
|
_todo()
|
||||||
|
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def initialize(name: str, spec: str = typer.Option(..., "--spec", "-f")) -> None:
|
||||||
|
del name
|
||||||
|
del spec
|
||||||
|
_todo()
|
||||||
|
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def start(name: str) -> None:
|
||||||
|
del name
|
||||||
|
_todo()
|
||||||
|
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def stop(name: str) -> None:
|
||||||
|
del name
|
||||||
|
_todo()
|
||||||
|
|
||||||
|
|
||||||
|
@app.command()
|
||||||
|
def delete(name: str) -> None:
|
||||||
|
del name
|
||||||
|
_todo()
|
||||||
10
components/l4d2-host-lib/tests/test_cli.py
Normal file
10
components/l4d2-host-lib/tests/test_cli.py
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
from typer.testing import CliRunner
|
||||||
|
|
||||||
|
from l4d2host.cli import app
|
||||||
|
|
||||||
|
|
||||||
|
def test_help_lists_v1_commands() -> None:
|
||||||
|
result = CliRunner().invoke(app, ["--help"])
|
||||||
|
assert result.exit_code == 0
|
||||||
|
for command in ["install", "initialize", "start", "stop", "delete"]:
|
||||||
|
assert command in result.output
|
||||||
Loading…
Reference in a new issue