diff options
author | dx <aryadevchavali1@gmail.com> | 2020-05-05 22:13:59 +0100 |
---|---|---|
committer | dx <aryadevchavali1@gmail.com> | 2020-05-05 22:13:59 +0100 |
commit | b01b351b30449255fa1504b7acf4eacd689e84c8 (patch) | |
tree | fe3177ba4b7b46ca8661af040c80219ec01106d4 | |
parent | df722396877ef76ffd1a5701b96173f9b647b3fa (diff) | |
download | mdhtml-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
-rw-r--r-- | converter.py | 12 |
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") + |