mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-21 10:17:05 +02:00
help_filter(): started
This commit is contained in:
1 parent
2d8a19c600
commit
e986edb5bf
1 file changed
+9
-8
@@ -933,7 +933,7 @@ async def main(argv):
|
|||||||
|
|
||||||
# TBD
|
# TBD
|
||||||
if args.mode == OPT_MODE_HELP:
|
if args.mode == OPT_MODE_HELP:
|
||||||
await help_filters(db)
|
await help_filters(db, parser)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# rebase file arguments due to moving the working directory to the script location
|
# rebase file arguments due to moving the working directory to the script location
|
||||||
@@ -996,22 +996,23 @@ async def main(argv):
|
|||||||
return None
|
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"""
|
"""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 } }'")
|
print("\tExample: --filters '{ \"data.summary.protagonist\": ACCOUNT_ID, \"data.summary.battle_start_timestamp\": { \"$gt\" : 1602853200 } }'")
|
||||||
if db != None:
|
if db != None:
|
||||||
dbc = db[DB_C_REPLAYS]
|
dbc = db[DB_C_REPLAYS]
|
||||||
try:
|
try:
|
||||||
res = await dbc.find_one()
|
res = await dbc.find_one()
|
||||||
summary = res['data']['summary']
|
summary = res['data']['summary']
|
||||||
details = summary[0]
|
details = summary['details'][0]
|
||||||
print('data.summary.KEYS:')
|
print('\n--filters KEYS:')
|
||||||
for s in summary:
|
for s in summary:
|
||||||
print("\t" + s)
|
print("\tdata.summary." + s)
|
||||||
print(print('data.summary.details.[].keys:'))
|
|
||||||
for d in details:
|
for d in details:
|
||||||
print("\t" + d)
|
print("\tdata.summary.details.[]." + d)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
bu.error(exception=err)
|
bu.error(exception=err)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user