31 lines
832 B
Python
31 lines
832 B
Python
"""
|
|
Parse commandline arguments and provide global variables for settings.
|
|
"""
|
|
|
|
import argparse
|
|
|
|
|
|
class Settings():
|
|
file = None
|
|
sort = "time"
|
|
debug = False
|
|
|
|
def __init__(self):
|
|
parser = argparse.ArgumentParser(description='IHK Dijkstra Projekt.')
|
|
parser.add_argument('file', help='The input file.')
|
|
parser.add_argument(
|
|
'-sort',
|
|
default='time',
|
|
help='Whether to sort after "time" or "co2"')
|
|
parser.add_argument(
|
|
'-debug',
|
|
action='store_true',
|
|
help='Show debug output.')
|
|
args = parser.parse_args()
|
|
assert(args.sort == "time" or args.sort == "co2")
|
|
|
|
# update default values
|
|
self.file = args.file
|
|
self.debug = args.debug
|
|
self.sort = args.sort
|