fsfi

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 086f890f3e602c2a2fa5de8124d512856b7f9ed6
parent 97f0b45c17199e2b7213217cbad8cea1461182fe
Author: rsiddharth <s@ricketyspace.net>
Date:   Wed, 15 May 2019 21:24:44 -0400

bin/news: Add write.

Diffstat:
bin/news | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/bin/news b/bin/news @@ -7,6 +7,7 @@ import datetime import os +import os.path import re import subprocess as subp import sys @@ -35,6 +36,16 @@ def read(f): return c +def write(p, c): + d = os.path.dirname(p) + + if not os.path.exists(d): + os.makedirs(d) + + with open(p, 'w') as f: + f.write(c) + + def slug(p): m = re.search(r'([a-zA-Z\-]+)\.md', p)