@main.command()<EOL>@click.pass_context<EOL>@onlineChain<EOL>@click.argument("<STR_LIT>", nargs=-<NUM_LIT:1>)<EOL>@click.option("<STR_LIT>", help="<STR_LIT>", default=False)<EOL>@click.option(<EOL>"<STR_LIT>", type=str, help="<STR_LIT>", multiple=True<EOL>)<EOL>@click.option("<STR_LIT>", type=str, help="<STR_LIT>", multiple=True)<EOL>@click.option("<STR_LIT>", type=int, help="<STR_LIT>", default=<NUM_LIT:15>)<EOL>@click.option("<STR_LIT>", default=False)<EOL>def history(ctx, account, limit, type, csv, exclude, raw):
from peerplaysbase.operations import getOperationNameForId<EOL>header = ["<STR_LIT:#>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>if csv:<EOL><INDENT>import csv<EOL>t = csv.writer(sys.stdout, delimiter="<STR_LIT:;>")<EOL>t.writerow(header)<EOL><DEDENT>else:<EOL><INDENT>t = PrettyTable(header)<EOL>t.align = "<STR_LIT:r>"<EOL>t.align["<STR_LIT>"] = "<STR_LIT:l>"<EOL><DEDENT>for a in account:<EOL><INDENT>account = Account(a, peerplays_instance=ctx.peerplays)<EOL>for b in account.history(limit=limit, only_ops=type, exclude_ops=exclude):<EOL><INDENT>row = [<EOL>b["<STR_LIT:id>"].split("<STR_LIT:.>")[<NUM_LIT:2>],<EOL>"<STR_LIT:%s>" % (b["<STR_LIT>"]),<EOL>"<STR_LIT>".format(getOperationNameForId(b["<STR_LIT>"][<NUM_LIT:0>]), b["<STR_LIT>"][<NUM_LIT:0>]),<EOL>pprintOperation(b) if not raw else json.dumps(b, indent=<NUM_LIT:4>),<EOL>]<EOL>if csv:<EOL><INDENT>t.writerow(row)<EOL><DEDENT>else:<EOL><INDENT>t.add_row(row)<EOL><DEDENT><DEDENT><DEDENT>if not csv:<EOL><INDENT>click.echo(t)<EOL><DEDENT>
Show history of an account