about summary refs log tree commit diff
path: root/strike.py
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-10-21 20:20:36 -0500
committerStarfall <us@starfall.systems>2023-12-05 10:00:15 -0600
commit8433efc2c31c6d49892c8354d2f43696d322586e (patch)
tree715e54fb85105186689f2aa12892bd0430434180 /strike.py
parentbf51e244b481d2048cb40551a063818f429533dc (diff)
strike: use argparser instead of hardcoding directories and filenames
Diffstat (limited to 'strike.py')
-rwxr-xr-xstrike.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/strike.py b/strike.py
index fb7378d..93c62f4 100755
--- a/strike.py
+++ b/strike.py
@@ -1,18 +1,25 @@
 #!/usr/bin/env python3
 from os import listdir, mkdir
 from sys import exit
+import argparse
 
 def get_output(content, template="{content}"):
     return template.format(content = content)
 
 def main():
-    src = 'blog'
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--input', '-i', help='input directory (default "blog")', default='blog')
+    parser.add_argument('--output', '-o', help='output directory (default "output")', default='output')
+    parser.add_argument('--template', '-t', help='template to use (default "template"', default='template')
+    args = parser.parse_args()
 
-    dest = 'output'
+    src = args.input
+
+    dest = args.output
     try: mkdir(dest)
     except FileExistsError: pass
 
-    template = 'template'
+    template = args.template
     with open(template) as t:
         template_contents = t.read()