From 867fa123a7c3f6f1ead592e03ee6901df383f87f Mon Sep 17 00:00:00 2001 From: neoarz Date: Sun, 12 Apr 2026 10:13:46 -0400 Subject: [PATCH] feat: add lazy cli commands --- pyproject.toml | 7 +++++-- src/syntrel/dev.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/syntrel/dev.py diff --git a/pyproject.toml b/pyproject.toml index b1413c4..39a4604 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/src/syntrel/dev.py b/src/syntrel/dev.py new file mode 100644 index 0000000..ed7d302 --- /dev/null +++ b/src/syntrel/dev.py @@ -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()