aboutsummaryrefslogtreecommitdiff
path: root/converter.py
diff options
context:
space:
mode:
authordx <aryadevchavali1@gmail.com>2020-05-05 22:13:59 +0100
committerdx <aryadevchavali1@gmail.com>2020-05-05 22:13:59 +0100
commitb01b351b30449255fa1504b7acf4eacd689e84c8 (patch)
treefe3177ba4b7b46ca8661af040c80219ec01106d4 /converter.py
parentdf722396877ef76ffd1a5701b96173f9b647b3fa (diff)
downloadmdhtml-b01b351b30449255fa1504b7acf4eacd689e84c8.tar.gz
mdhtml-b01b351b30449255fa1504b7acf4eacd689e84c8.tar.bz2
mdhtml-b01b351b30449255fa1504b7acf4eacd689e84c8.zip
+argument validation for markdown file test
Usign regex to check if each file is a markdown file or not, skipping any that are
Diffstat (limited to 'converter.py')
-rw-r--r--converter.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/converter.py b/converter.py
index 07944f4..79624f7 100644
--- a/converter.py
+++ b/converter.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
from optparse import OptionParser
+from re import search, sub
"""Command line arguments"""
usage = "usage: %prog [options] file..."
parser = OptionParser(usage=usage)
@@ -13,3 +14,14 @@ parser.add_option('-o', '--output-type', dest='output_type',
(options, args) = parser.parse_args()
+"""Valid argument testing
+TODO: Add support for directories
+"""
+markdown_files = []
+for file in args:
+ if search(".md", file) is not None:
+ # Is a markdown file
+ markdown_files.append(file)
+ else:
+ print(file, "is not a markdown file, skipping")
+