Merge pull request #4 from Jylpah/dev

--mode help fixes
This commit is contained in:
Jylpah authored and GitHub committed 2020-10-28 09:57:12 +02:00
commit d14e972f4d
1 file changed
+12 -8
+12 -8
View File
@@ -938,7 +938,7 @@ async def main(argv):
# TBD
if args.mode == OPT_MODE_HELP:
await help_filters(db)
await help_extended(db, parser)
sys.exit(0)
# rebase file arguments due to moving the working directory to the script location
@@ -1001,22 +1001,26 @@ async def main(argv):
return None
async def help_filters(db : motor.motor_asyncio.AsyncIOMotorDatabase = None):
async def help_extended(db : motor.motor_asyncio.AsyncIOMotorDatabase = None, parser: argparse.ArgumentParser = None):
"""Help for --filters"""
print("Syntax: --filters '{ \"replay.param\": VALUE, \"replay.param2\": { \"$MONGO_OPERATOR\" : VALUE }, ... }'")
if parser != None:
parser.print_help()
# Result category options
# Filter usage
print("\nSyntax: --filters '{ \"replay.param\": VALUE, \"replay.param2\": { \"$MONGO_OPERATOR\" : VALUE }, ... }'")
print("\tExample: --filters '{ \"data.summary.protagonist\": ACCOUNT_ID, \"data.summary.battle_start_timestamp\": { \"$gt\" : 1602853200 } }'")
if db != None:
dbc = db[DB_C_REPLAYS]
try:
res = await dbc.find_one()
summary = res['data']['summary']
details = summary[0]
print('data.summary.KEYS:')
details = summary['details'][0]
print('\n--filters KEYS:')
for s in summary:
print("\t" + s)
print(print('data.summary.details.[].keys:'))
print("\tdata.summary." + s)
for d in details:
print("\t" + d)
print("\tdata.summary.details.[]." + d)
except Exception as err:
bu.error(exception=err)