First version of note.py
This commit is contained in:
parent
15349ee9c4
commit
829320940d
22
note.py
Normal file
22
note.py
Normal file
@ -0,0 +1,22 @@
|
||||
from argparse import ArgumentParser
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
ZETTELDIR = Path.home() / "Zettelkasten"
|
||||
TIMESTAMP = "%Y%m%d%H%M"
|
||||
TEMPLATE = """# {title}
|
||||
tags = #
|
||||
"""
|
||||
|
||||
ap = ArgumentParser()
|
||||
ap.add_argument('title')
|
||||
args = ap.parse_args()
|
||||
|
||||
ts = datetime.now().strftime(TIMESTAMP)
|
||||
|
||||
filename = ZETTELDIR / f"{ts} {args.title}.md"
|
||||
|
||||
with open(filename, "w") as fh:
|
||||
fh.write(TEMPLATE.format(title=args.title))
|
||||
|
||||
print(filename)
|
7
pyproject.toml
Normal file
7
pyproject.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[project]
|
||||
name = "zettelkak"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9"
|
||||
dependencies = []
|
Loading…
x
Reference in New Issue
Block a user