コード例 #1
0
def show(ctx):
    pass_ctx_from_parent(ctx)
    accounts = ctx.db.list_source_accounts(ctx.source)
    headers = [obj['key'] for obj in ctx.schema['config']]
    data = [[account_data['receive_md']] + sort_account_config(account_data['config'], headers) for account_data in accounts]
    table = tabulate(data, headers=['receive_md'] + headers, tablefmt='simple')
    click.echo(table)
コード例 #2
0
def edit(ctx, receive_md, id):
    pass_ctx_from_parent(ctx)
    account_id = ctx.source + '_' + id
    account_data = ctx.db.find_account(account_id)
    if account_data:
        answers = encrypt(ctx.schema, prompt(make_questions(ctx.schema, account_data['config'])))
        receive_md = receive_md or account_data['receive_md']
        ctx.db.add_account(account_id=account_id, source_name=ctx.source, receive_md=receive_md, config=answers)
    else:
        click.echo('Account not found')