From 8d64909b296d293258910a7f67cc927630cd5302 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 21 Oct 2009 13:54:04 -0400 Subject: Removed the pre 2.3 commandline stuff as we don't support those older versions anyway. --- markdown/commandline.py | 31 ++----------------------------- 1 file 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", -- cgit v1.2.3