Added an --unround option, to show full precision
This commit is contained in:
parent
c57c85c92f
commit
c49b98fc4c
5 changed files with 32 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
.Dd February 25, 2009
|
.Dd February 27, 2009
|
||||||
.Dt ledger 1
|
.Dt ledger 1
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm ledger
|
.Nm ledger
|
||||||
|
|
@ -206,6 +206,7 @@ appeared in the original journal file.
|
||||||
.It Fl \-truncate
|
.It Fl \-truncate
|
||||||
.It Fl \-unbudgeted
|
.It Fl \-unbudgeted
|
||||||
.It Fl \-uncleared Pq Fl U
|
.It Fl \-uncleared Pq Fl U
|
||||||
|
.It Fl \-unround
|
||||||
.It Fl \-verbose
|
.It Fl \-verbose
|
||||||
.It Fl \-verify
|
.It Fl \-verify
|
||||||
.It Fl \-version
|
.It Fl \-version
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,10 @@ post_handler_ptr chain_post_handlers(report_t& report,
|
||||||
handler.reset(new calc_posts(handler, expr));
|
handler.reset(new calc_posts(handler, expr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unround_posts will unround the amounts in all postings
|
||||||
|
if (report.HANDLED(unround))
|
||||||
|
handler.reset(new unround_posts(handler));
|
||||||
|
|
||||||
// filter_posts will only pass through posts matching the
|
// filter_posts will only pass through posts matching the
|
||||||
// `secondary_predicate'.
|
// `secondary_predicate'.
|
||||||
if (report.HANDLED(only_)) {
|
if (report.HANDLED(only_)) {
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,29 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Brief
|
||||||
|
*
|
||||||
|
* Long.
|
||||||
|
*/
|
||||||
|
class unround_posts : public item_handler<post_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
unround_posts(post_handler_ptr handler)
|
||||||
|
: item_handler<post_t>(handler) {
|
||||||
|
TRACE_CTOR(unround_posts, "posts_list&");
|
||||||
|
}
|
||||||
|
virtual ~unround_posts() {
|
||||||
|
TRACE_DTOR(unround_posts);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void operator()(post_t& post) {
|
||||||
|
post.xdata().value = post.amount.unrounded();
|
||||||
|
post.xdata().add_flags(POST_EXT_COMPOUND);
|
||||||
|
item_handler<post_t>::operator()(post);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class posts_iterator;
|
class posts_iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -542,6 +542,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
|
||||||
case 'u':
|
case 'u':
|
||||||
OPT(unbudgeted);
|
OPT(unbudgeted);
|
||||||
else OPT(uncleared);
|
else OPT(uncleared);
|
||||||
|
else OPT(unround);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
OPT(weekly);
|
OPT(weekly);
|
||||||
|
|
|
||||||
|
|
@ -643,6 +643,8 @@ public:
|
||||||
parent->HANDLER(limit_).on("uncleared|pending");
|
parent->HANDLER(limit_).on("uncleared|pending");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
OPTION(report_t, unround);
|
||||||
|
|
||||||
OPTION_(report_t, weekly, DO() { // -W
|
OPTION_(report_t, weekly, DO() { // -W
|
||||||
parent->HANDLER(period_).on("weekly");
|
parent->HANDLER(period_).on("weekly");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue