aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@dev.(none)>2009-10-21 13:54:04 -0400
committerWaylan Limberg <waylan@dev.(none)>2009-10-21 13:54:04 -0400
commit8d64909b296d293258910a7f67cc927630cd5302 (patch)
tree5a85c4795c033d7d451d3bf7d7ebd7cb72bd0ea0
parent243f6dd416fbcd62ecf42dfe3b5816f3c90faa0e (diff)
downloadmarkdown-8d64909b296d293258910a7f67cc927630cd5302.tar.gz
markdown-8d64909b296d293258910a7f67cc927630cd5302.tar.bz2
markdown-8d64909b296d293258910a7f67cc927630cd5302.zip
Removed the pre 2.3 commandline stuff as we don't support those older versions anyway.
-rw-r--r--markdown/commandline.py31
1 files changed, 2 insertions, 29 deletions
diff --git a/markdown/commandline.py b/markdown/commandline.py
index 78dfc5a..7acc06d 100644
--- a/markdown/commandline.py
+++ b/markdown/commandline.py
@@ -2,47 +2,20 @@
COMMAND-LINE SPECIFIC STUFF
=============================================================================
-The rest of the code is specifically for handling the case where Python
-Markdown is called from the command line.
"""
import markdown
import sys
+import optparse
import logging
from logging import DEBUG, INFO, WARN, ERROR, CRITICAL
-EXECUTABLE_NAME_FOR_USAGE = "python markdown"
-""" The name used in the usage statement displayed for python versions < 2.3.
-(With python 2.3 and higher the usage statement is generated by optparse
-and uses the actual name of the executable called.) """
-
-OPTPARSE_WARNING = """
-Python 2.3 or higher required for advanced command line options.
-For lower versions of Python use:
-
- %s INPUT_FILE > OUTPUT_FILE
-
-""" % EXECUTABLE_NAME_FOR_USAGE
-
def parse_options():
"""
Define and parse `optparse` options for command-line usage.
"""
- try:
- optparse = __import__("optparse")
- except:
- if len(sys.argv) == 2:
- return {'input': sys.argv[1],
- 'output': None,
- 'safe': False,
- 'extensions': [],
- 'encoding': None }, CRITICAL
- else:
- print OPTPARSE_WARNING
- return None, None
-
- parser = optparse.OptionParser(usage="%prog INPUTFILE [options]",
+ parser = optparse.OptionParser(usage="%prog [options] INPUTFILE",
version="%%prog %s" % markdown.version)
parser.add_option("-f", "--file", dest="filename", default=sys.stdout,
help="write output to OUTPUT_FILE",