@bookie.command()<EOL>@click.argument("<STR_LIT>", default=None, required=False)<EOL>@click.pass_context<EOL>@onlineChain<EOL>def list(ctx, sport):
from .ui import maplist2dict<EOL>from tqdm import tqdm<EOL>from treelib import Node, Tree<EOL>tree = Tree()<EOL>tree.create_node("<STR_LIT>", "<STR_LIT:root>")<EOL>def formatname(o):<EOL><INDENT>if "<STR_LIT:name>" in o:<EOL><INDENT>name = o.get("<STR_LIT:name>")<EOL><DEDENT>elif "<STR_LIT:description>" in o:<EOL><INDENT>name = o.get("<STR_LIT:description>")<EOL><DEDENT>else:<EOL><INDENT>name = []<EOL><DEDENT>return "<STR_LIT>".format(<EOL>maplist2dict(name).get("<STR_LIT>"),<EOL>o["<STR_LIT:id>"]<EOL>)<EOL><DEDENT>if sport:<EOL><INDENT>sports = [Sport(sport, peerplays_instance=ctx.peerplays)]<EOL><DEDENT>else:<EOL><INDENT>sports = Sports()<EOL><DEDENT>for sport in tqdm(sports):<EOL><INDENT>tree.create_node(<EOL>formatname(sport),<EOL>sport["<STR_LIT:id>"],<EOL>parent="<STR_LIT:root>")<EOL>for eg in tqdm(sport.eventgroups):<EOL><INDENT>tree.create_node(<EOL>formatname(eg),<EOL>eg["<STR_LIT:id>"],<EOL>parent=sport["<STR_LIT:id>"])<EOL>for e in tqdm(eg.events):<EOL><INDENT>tree.create_node(<EOL>formatname(e),<EOL>e["<STR_LIT:id>"],<EOL>parent=eg["<STR_LIT:id>"])<EOL>for bmg in tqdm(e.bettingmarketgroups):<EOL><INDENT>tree.create_node(<EOL>formatname(bmg),<EOL>bmg["<STR_LIT:id>"],<EOL>parent=e["<STR_LIT:id>"])<EOL>for bm in tqdm(bmg.bettingmarkets):<EOL><INDENT>tree.create_node(<EOL>formatname(bm),<EOL>bm["<STR_LIT:id>"],<EOL>parent=bmg["<STR_LIT:id>"])<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>tree.show()<EOL>
[bookie] list the entire thing