diff --git a/elite_info.py b/elite_info.py index 84712cf..b72ad54 100755 --- a/elite_info.py +++ b/elite_info.py @@ -1,12 +1,17 @@ #!/usr/bin/python from companion import Session, VerificationRequired +import argparse import os import utils +flag_parser = argparse.ArgumentParser(description="Report information about your Elite: Dangerous character.") +flag_parser.add_argument('--dump', action='store_true', help="Dump raw data.") + def main(): settings = utils.get_settings() session = Session() + flags = flag_parser.parse_args() try: session.login(settings.get('ed_companion', 'username'), settings.get('ed_companion', 'password')) @@ -17,9 +22,12 @@ def main(): data = session.query() # Now we have the data! - print "Commander %s" % data['commander']['name'] - print "Credits: %s" % data['commander']['credits'] - print "Location: %s" % data['lastSystem']['name'] + if flags.dump: + print data + else: + print "Commander %s" % data['commander']['name'] + print "Credits: %s" % data['commander']['credits'] + print "Location: %s" % data['lastSystem']['name'] session.close()