A New Script - 2021-07-23 17:52
===============================

I wrote a new script to to make it easier to start new posts. Here it is:

   #!/usr/bin/env python3
   import os
   import re
   import subprocess
   from datetime import datetime
   from pathlib import Path

   DEFAULT_EXT = '.md'
   EDITOR = os.environ.get('EDITOR', 'vim')
   title = input('Title: ')
   dashed_title = re.sub(r'\s+','-', title)
   if not title.strip():
       print('Title is empty, aborting')
       exit(0)
   path = Path(f"{datetime.now():%y%m%d}-{dashed_title.lower()}")
   path = path.with_suffix(path.suffix or DEFAULT_EXT)
   if input(f'Edit {path!s}? (Y/n): ').lower().strip() in ('', 'y', 'yes'):
       header = f"{title} - {datetime.now():%Y-%m-%d %H:%M}"
       path.write_text(f"{header}\n{'='*len(header)}")
       subprocess.run([EDITOR, path])


It's nothing fancy, but... maybe it's helpful to you!