From 332a5c2553db41de777473a1e1be9cd1522c9496 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 31 Mar 2016 18:54:41 +0100 Subject: Move the src directory to poezio, for better cython compatibility. --- poezio/args.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 poezio/args.py (limited to 'poezio/args.py') diff --git a/poezio/args.py b/poezio/args.py new file mode 100644 index 00000000..63e77927 --- /dev/null +++ b/poezio/args.py @@ -0,0 +1,28 @@ +""" +Module related to the argument parsing + +There is a fallback to the deprecated optparse if argparse is not found +""" +from os import path +from argparse import ArgumentParser, SUPPRESS + +def parse_args(CONFIG_PATH=''): + """ + Parse the arguments from the command line + """ + parser = ArgumentParser('poezio') + parser.add_argument("-c", "--check-config", dest="check_config", + action='store_true', + help='Check the config file') + parser.add_argument("-d", "--debug", dest="debug", + help="The file where debug will be written", + metavar="DEBUG_FILE") + 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("-v", "--version", dest="version", + help=SUPPRESS, metavar="VERSION", + default="1.0-dev") + options = parser.parse_args() + return options -- cgit v1.2.3