some more refactoring; output format for cords might change

This commit is contained in:
alterNERDtive 2020-01-08 08:55:37 +01:00
parent 6ff10430eb
commit 2ccdd684a2

View file

@ -20,11 +20,7 @@ def distanceBetween(system1, system2):
+ (coords1['z']-coords2['z'])**2 ),0)) + (coords1['z']-coords2['z'])**2 ),0))
def getCommanderPosition(name, apikey): def getCommanderPosition(name, apikey):
coords = Commander(name, apikey).currentPosition return Commander(name, apikey).currentPosition
ret = ""
for k in coords:
ret += "{}: {}, ".format(k, coords[k])
return ret[:-2]
def getCommanderProfileUrl(name, apikey): def getCommanderProfileUrl(name, apikey):
return Commander(name, apikey).profileUrl return Commander(name, apikey).profileUrl
@ -76,7 +72,11 @@ try:
out = distanceBetween(args.system[0], args.system[1]) out = distanceBetween(args.system[0], args.system[1])
elif args.subCommand == "findcommander": elif args.subCommand == "findcommander":
if args.coords: if args.coords:
out = getCommanderPosition(args.name, args.apikey) coords = getCommanderPosition(args.name, args.apikey)
out = ""
for k in coords:
out += "{}: {}, ".format(k, coords[k])
out = out[:-2]
elif args.url: elif args.url:
out = getCommanderProfileUrl(args.name, args.apikey) out = getCommanderProfileUrl(args.name, args.apikey)
else: else: