help_filter(): started

This commit is contained in:
Jylpah committed 2020-10-26 00:25:53 +02:00
1 parent 2d8a19c600
commit e986edb5bf
1 file changed
+9 -8
+9 -8
View File
@@ -933,7 +933,7 @@ async def main(argv):
# TBD
if args.mode == OPT_MODE_HELP:
await help_filters(db)
await help_filters(db, parser)
sys.exit(0)
# rebase file arguments due to moving the working directory to the script location
@@ -996,22 +996,23 @@ async def main(argv):
return None
async def help_filters(db : motor.motor_asyncio.AsyncIOMotorDatabase = None):
async def help_filters(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()
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)