打印余额CLI

打印余额CLI

问题描述:

莱杰(http://ledger-cli.org/)允许使用下面的命令你的收入占的输出反向排序平衡:打印余额CLI

ledger -f money.txt bal Income --sort "-abs(total)" 

所以输出如下所示:

$-7,715.00 Income 
    $-6,789.10 Payroll 
    $-567.89 Insurance 
    $-234.56 Gift Card 
    $-200.56  Store 1 
    $-34.00  Store 2 
    $-123.45 Coupons 

有没有办法以CSV格式输出相同的信息,但保留类别的缩进如下(标题值不重要)?

"Amount","Level 1","Level 2,"Level 3" 
    $-7,715.00,Income,, 
    ,$-6,789.10,Payroll, 
    ,$-567.89,Insurance, 
    ,$-234.56,Gift Card, 
    ,,$-200.56,Store 1 
    ,,$-34.00,Store 2 
    ,$-123.45,Coupons, 

您可以使用--balance-format选项与任何documented format strings的。

例如要打印每行上的帐户名称和总金额: ledger -f money.txt balance ^Income --no-total --balance-format '%A,%T\n'