zettelkak/note.py
2025-08-30 14:58:58 +10:00

23 lines
453 B
Python

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)