19 lines
485 B
Python
Executable File
19 lines
485 B
Python
Executable File
#!/usr/bin/python
|
|
from time import strftime, localtime
|
|
import sys
|
|
import os
|
|
import re
|
|
|
|
r = re.compile('[^a-zA-Z]')
|
|
TEMPLATE = open("/home/nihilazo/Documents/05-Templates/document.md","r").read()
|
|
date = strftime("%Y-%m-%d", localtime())
|
|
title = sys.argv[1]
|
|
ftitle = r.sub('', title.strip().lower())
|
|
fname = "{}-{}.md".format(date,ftitle)
|
|
|
|
if not os.path.isfile(fname):
|
|
with open(fname,"w+") as f:
|
|
f.write(TEMPLATE.format(title=title, date=date))
|
|
|
|
os.system("nvim " + fname)
|