feat: add lazy cli commands

This commit is contained in:
neoarz
2026-04-12 10:13:46 -04:00
parent 7ec28ae194
commit 867fa123a7
2 changed files with 41 additions and 2 deletions

View File

@@ -1,15 +1,18 @@
[project]
name = "syntrel"
version = "0.1.0"
description = "Clean-slate rewrite of the Syntrel Discord bot."
description = "Syntrel Discord bot"
authors = [
{ name = "neoarz", email = "hi@neoarz.com" }
{ name = "Nazeef", email = "neoarz@proton.me" }
]
requires-python = ">=3.14"
dependencies = []
[project.scripts]
syntrel = "syntrel.cli:main"
lint = "syntrel.dev:lint"
format = "syntrel.dev:format"
check = "syntrel.dev:check"
[build-system]
requires = ["uv_build>=0.11.3,<0.12.0"]

36
src/syntrel/dev.py Normal file
View File

@@ -0,0 +1,36 @@
from __future__ import annotations
import subprocess
import sys
def _run(*args: str) -> None:
completed = subprocess.run(
[sys.executable, "-m", *args],
check=False,
capture_output=True,
text=True,
)
print(" ".join(args))
for stream in (completed.stdout, completed.stderr):
for line in stream.splitlines():
print(f" {line}")
if completed.returncode != 0:
raise SystemExit(completed.returncode)
def lint() -> None:
_run("ruff", "check", ".")
_run("ty", "check")
def format() -> None:
_run("ruff", "check", "--fix", ".")
_run("ruff", "format", ".")
def check() -> None:
lint()