extract cli to separate dir.
default create parents .plan dir.
This commit is contained in:
parent
02dde14630
commit
e1575c85a1
|
@ -5,10 +5,15 @@ description = "edit ~/.plan files"
|
|||
authors = [{ name = "gitmatt", email = "git@publicmatt.com" }]
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = ["click>=8.1.8", "jinja2>=3.1.5", "rich>=13.9.4"]
|
||||
dependencies = [
|
||||
"click>=8.1.8",
|
||||
"click-default-group>=1.2.4",
|
||||
"jinja2>=3.1.5",
|
||||
"rich>=13.9.4",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
plan = "plan:__main__.main"
|
||||
plan = "plan:cli.cli"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import click
|
||||
|
||||
from .path import open, today
|
||||
|
||||
|
||||
@click.command()
|
||||
def main():
|
||||
open(today())
|
|
@ -0,0 +1,13 @@
|
|||
import click
|
||||
from click_default_group import DefaultGroup
|
||||
from .path import open, today
|
||||
|
||||
|
||||
@click.group(cls=DefaultGroup, default="today", default_if_no_args=True)
|
||||
def cli():
|
||||
pass
|
||||
|
||||
|
||||
@cli.command("today")
|
||||
def open_today():
|
||||
open(today())
|
|
@ -14,6 +14,7 @@ def today() -> Path:
|
|||
def open(plan: Path):
|
||||
import subprocess
|
||||
|
||||
plan.parent.mkdir(parents=True, exist_ok=True)
|
||||
if not plan.exists():
|
||||
plan.touch()
|
||||
with plan.open("w") as f:
|
||||
|
|
16
uv.lock
16
uv.lock
|
@ -13,6 +13,18 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/7e/d4/7ebdbd03970677812aac39c869717059dbb71a4cfc033ca6e5221787892c/click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2", size = 98188 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click-default-group"
|
||||
version = "1.2.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/1d/ce/edb087fb53de63dad3b36408ca30368f438738098e668b78c87f93cd41df/click_default_group-1.2.4.tar.gz", hash = "sha256:eb3f3c99ec0d456ca6cd2a7f08f7d4e91771bef51b01bdd9580cc6450fe1251e", size = 3505 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/2c/1a/aff8bb287a4b1400f69e09a53bd65de96aa5cee5691925b38731c67fc695/click_default_group-1.2.4-py2.py3-none-any.whl", hash = "sha256:9b60486923720e7fc61731bdb32b617039aba820e22e1c88766b1125592eaa5f", size = 4123 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
|
@ -95,10 +107,11 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "plan"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
{ name = "click-default-group" },
|
||||
{ name = "jinja2" },
|
||||
{ name = "rich" },
|
||||
]
|
||||
|
@ -106,6 +119,7 @@ dependencies = [
|
|||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "click", specifier = ">=8.1.8" },
|
||||
{ name = "click-default-group", specifier = ">=1.2.4" },
|
||||
{ name = "jinja2", specifier = ">=3.1.5" },
|
||||
{ name = "rich", specifier = ">=13.9.4" },
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue