Restored the 'print' command.
This commit is contained in:
parent
24e64c202e
commit
1b083919c0
4 changed files with 17 additions and 3 deletions
|
|
@ -407,7 +407,10 @@ namespace ledger {
|
||||||
}
|
}
|
||||||
else if (verb == "print" || verb == "p") {
|
else if (verb == "print" || verb == "p") {
|
||||||
verb = "print";
|
verb = "print";
|
||||||
command = reporter<>(new format_xacts(report, session.print_format));
|
command = reporter<>(new format_xacts(report,
|
||||||
|
report.format_string.empty() ?
|
||||||
|
session.print_format :
|
||||||
|
report.format_string));
|
||||||
}
|
}
|
||||||
else if (verb == "balance" || verb == "bal" || verb == "b") {
|
else if (verb == "balance" || verb == "bal" || verb == "b") {
|
||||||
verb = "balance";
|
verb = "balance";
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,18 @@ format_xacts::format_xacts(report_t& _report, const string& format)
|
||||||
|
|
||||||
if (const char * p = std::strstr(f, "%/")) {
|
if (const char * p = std::strstr(f, "%/")) {
|
||||||
first_line_format.parse(string(f, 0, p - f));
|
first_line_format.parse(string(f, 0, p - f));
|
||||||
next_lines_format.parse(string(p + 2));
|
const char * n = p + 2;
|
||||||
|
if (const char * p = std::strstr(n, "%/")) {
|
||||||
|
next_lines_format.parse(string(n, 0, p - n));
|
||||||
|
between_format.parse(string(p + 2));
|
||||||
|
} else {
|
||||||
|
next_lines_format.parse(n);
|
||||||
|
between_format.parse("\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
first_line_format.parse(format);
|
first_line_format.parse(format);
|
||||||
next_lines_format.parse(format);
|
next_lines_format.parse(format);
|
||||||
|
between_format.parse("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,6 +64,8 @@ void format_xacts::operator()(xact_t& xact)
|
||||||
if (! xact.has_xdata() ||
|
if (! xact.has_xdata() ||
|
||||||
! xact.xdata().has_flags(XACT_EXT_DISPLAYED)) {
|
! xact.xdata().has_flags(XACT_EXT_DISPLAYED)) {
|
||||||
if (last_entry != xact.entry) {
|
if (last_entry != xact.entry) {
|
||||||
|
if (last_entry)
|
||||||
|
between_format.format(out, *last_entry);
|
||||||
first_line_format.format(out, xact);
|
first_line_format.format(out, xact);
|
||||||
last_entry = xact.entry;
|
last_entry = xact.entry;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ protected:
|
||||||
report_t& report;
|
report_t& report;
|
||||||
format_t first_line_format;
|
format_t first_line_format;
|
||||||
format_t next_lines_format;
|
format_t next_lines_format;
|
||||||
|
format_t between_format;
|
||||||
entry_t * last_entry;
|
entry_t * last_entry;
|
||||||
xact_t * last_xact;
|
xact_t * last_xact;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ session_t::session_t()
|
||||||
("%-.9D %-.35P %-.39A %22.108t %!22.132T\n%/"
|
("%-.9D %-.35P %-.39A %22.108t %!22.132T\n%/"
|
||||||
"%48|%-.38A %22.108t %!22.132T\n"),
|
"%48|%-.38A %22.108t %!22.132T\n"),
|
||||||
print_format
|
print_format
|
||||||
("\n%d %Y%C%P\n %-34W %12o%n\n%/ %-34W %12o%n\n"),
|
("%(date)%(cleared ? \" *\" : (uncleared ? \"\" : \" !\"))%(code ? \" (\" + code + \")\" : \"\") %(payee)\n %-34(account) %12(amount)\n%/ %-34(account) %12(amount)%(note ? \" ; \" + note : \"\")\n"),
|
||||||
balance_format
|
balance_format
|
||||||
("%20T %_%-a\n"),
|
("%20T %_%-a\n"),
|
||||||
equity_format
|
equity_format
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue