summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/args.py42
1 files changed, 12 insertions, 30 deletions
diff --git a/src/args.py b/src/args.py
index 030f7212..95acbfd6 100644
--- a/src/args.py
+++ b/src/args.py
@@ -5,39 +5,21 @@ There is a fallback to the deprecated optparse if argparse is not found
"""
from gettext import gettext as _
from os import path
+from argparse import ArgumentParser, SUPPRESS
def parse_args(CONFIG_PATH=''):
"""
Parse the arguments from the command line
"""
- try:
- from argparse import ArgumentParser, SUPPRESS
- except ImportError:
- from optparse import OptionParser
- from optparse import SUPPRESS_HELP as SUPPRESS
- parser = OptionParser()
- parser.add_option("-f", "--file", dest="filename",
- default=path.join(CONFIG_PATH, 'poezio.cfg'),
- help=_("The config file you want to use"),
- metavar="CONFIG_FILE")
- parser.add_option("-d", "--debug", dest="debug",
- help=_("The file where debug will be written"),
- metavar="DEBUG_FILE")
- parser.add_option("-v", "--version", dest="version",
- help=SUPPRESS, metavar="VERSION",
- default="0.9-dev")
- (options, __) = parser.parse_args()
- else:
- parser = ArgumentParser()
- parser.add_argument("-f", "--file", dest="filename",
- default=path.join(CONFIG_PATH, 'poezio.cfg'),
- help=_("The config file you want to use"),
- metavar="CONFIG_FILE")
- parser.add_argument("-d", "--debug", dest="debug",
- help=_("The file where debug will be written"),
- metavar="DEBUG_FILE")
- parser.add_argument("-v", "--version", dest="version",
- help=SUPPRESS, metavar="VERSION",
- default="0.9-dev")
- options = parser.parse_args()
+ parser = ArgumentParser()
+ parser.add_argument("-f", "--file", dest="filename",
+ default=path.join(CONFIG_PATH, 'poezio.cfg'),
+ help=_("The config file you want to use"),
+ metavar="CONFIG_FILE")
+ parser.add_argument("-d", "--debug", dest="debug",
+ help=_("The file where debug will be written"),
+ metavar="DEBUG_FILE")
+ parser.add_argument("-v", "--version", action="version",
+ version="0.9-dev")
+ options = parser.parse_args()
return options