23 lines
453 B
Python
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)
|