def cli(env, limit, closed=False, get_all=False):
    """Invoices and all that mess"""

    manager = AccountManager(env.client)
    invoices = manager.get_invoices(limit, closed, get_all)

    table = formatting.Table([
        "Id", "Created", "Type", "Status", "Starting Balance", "Ending Balance", "Invoice Amount", "Items"
    ])
    table.align['Starting Balance'] = 'l'
    table.align['Ending Balance'] = 'l'
    table.align['Invoice Amount'] = 'l'
    table.align['Items'] = 'l'
    if isinstance(invoices, dict):
        invoices = [invoices]
    for invoice in invoices:
        table.add_row([
            invoice.get('id'),
            utils.clean_time(invoice.get('createDate'), out_format="%Y-%m-%d"),
            invoice.get('typeCode'),
            invoice.get('statusCode'),
            invoice.get('startingBalance'),
            invoice.get('endingBalance'),
            invoice.get('invoiceTotalAmount'),
            invoice.get('itemCount')
        ])
    env.fout(table)
def cli ( env , limit , closed = False , get_all = False ) : manager = AccountManager ( env . client ) invoices = manager . get_invoices ( limit , closed , get_all ) table = formatting . Table ( [ "Id" , "Created" , "Type" , "Status" , "Starting Balance" , "Ending Balance" , "Invoice Amount" , "Items" ] ) table . align [ 'Starting Balance' ] = 'l' table . align [ 'Ending Balance' ] = 'l' table . align [ 'Invoice Amount' ] = 'l' table . align [ 'Items' ] = 'l' if isinstance ( invoices , dict ) : invoices = [ invoices ] for invoice in invoices : table . add_row ( [ invoice . get ( 'id' ) , utils . clean_time ( invoice . get ( 'createDate' ) , out_format = "%Y-%m-%d" ) , invoice . get ( 'typeCode' ) , invoice . get ( 'statusCode' ) , invoice . get ( 'startingBalance' ) , invoice . get ( 'endingBalance' ) , invoice . get ( 'invoiceTotalAmount' ) , invoice . get ( 'itemCount' ) ] ) env . fout ( table )
Invoices and all that mess