mirror of
https://github.com/neoarz/Syntrel.git
synced 2026-05-11 23:35:40 +02:00
feat: add lazy cli commands
This commit is contained in:
@@ -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
36
src/syntrel/dev.py
Normal 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()
|
||||
Reference in New Issue
Block a user