diff options
author | John Wiegley <johnw@newartisans.com> | 2010-05-22 15:40:38 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-05-22 21:35:02 -0400 |
commit | de3803d0277353520116f05c7b2357196a8cfe48 (patch) | |
tree | 4648465cf73f1879d3d191924bdf905f96148924 /src/report.cc | |
parent | e3ba0117a39a3665743df5a1d5ca3b77ca2f00ec (diff) | |
download | fork-ledger-de3803d0277353520116f05c7b2357196a8cfe48.tar.gz fork-ledger-de3803d0277353520116f05c7b2357196a8cfe48.tar.bz2 fork-ledger-de3803d0277353520116f05c7b2357196a8cfe48.zip |
Added new commands: acounts, payees, commodities
These three reports simply dump an unordered list (with the exception of
payees) shows all accounts, payees, and commodities represented in a
given report. This can be used to easily generate per-entity report,
for example:
ledger payees | \
while read payee; do \
echo ; echo $payee ; \
ledger reg payee "$payee" ; \
done
Diffstat (limited to 'src/report.cc')
-rw-r--r-- | src/report.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/report.cc b/src/report.cc index 1180c019..509be8b1 100644 --- a/src/report.cc +++ b/src/report.cc @@ -1222,6 +1222,12 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, case symbol_t::COMMAND: switch (*p) { + case 'a': + if (is_eq(p, "accounts")) + return WRAP_FUNCTOR(reporter<>(new report_accounts(*this), *this, + "#accounts")); + break; + case 'b': if (*(p + 1) == '\0' || is_eq(p, "bal") || is_eq(p, "balance")) { return expr_t::op_t::wrap_functor @@ -1262,8 +1268,13 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, maybe_format(HANDLER(prepend_format_))), *this, "#cleared")); } - else if (is_eq(p, "convert")) + else if (is_eq(p, "convert")) { return WRAP_FUNCTOR(convert_command); + } + else if (is_eq(p, "commodities")) { + return WRAP_FUNCTOR(reporter<>(new report_commodities(*this), *this, + "#commodities")); + } break; case 'e': @@ -1296,6 +1307,9 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, (new format_posts(*this, report_format(HANDLER(pricedb_format_)), maybe_format(HANDLER(prepend_format_))), *this, "#pricedb")); + else if (is_eq(p, "payees")) + return WRAP_FUNCTOR(reporter<>(new report_payees(*this), *this, + "#payees")); break; case 'r': |