Enabled --current option

This commit is contained in:
John Wiegley 2009-02-20 19:10:16 -04:00
parent 8483ea16e2
commit 96782df17c
4 changed files with 29 additions and 1 deletions

View file

@ -297,7 +297,9 @@ public:
"%(quoted(join(note)))\n");
});
OPTION(report_t, current); // -c
OPTION_(report_t, current, DO() { // -c
parent->HANDLER(limit_).on("date<=today");
});
OPTION_(report_t, daily, DO() {
parent->HANDLER(period_).on("daily");

View file

@ -241,6 +241,11 @@ expr_t::ptr_op_t session_t::lookup(const string& name)
return MAKE_OPT_HANDLER(session_t, handler);
}
break;
case 't':
if (is_eq(p, "today"))
return MAKE_FUNCTOR(session_t::fn_today);
break;
}
return symbol_scope_t::lookup(name);

View file

@ -98,6 +98,10 @@ public:
clean_accounts();
}
value_t fn_today(call_scope_t&) {
return CURRENT_DATE();
}
option_t<session_t> * lookup_option(const char * p);
virtual expr_t::ptr_op_t lookup(const string& name);

View file

@ -0,0 +1,17 @@
bal --current
<<<
2007/02/02 RD VMMXX
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
2700/02/02 RD VMMXX
Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00
Income:Dividends:Vanguard:VMMXX $-0.35
>>>1
0.350 VMMXX Assets:Investments:Vanguard:VMMXX
$-0.35 Income:Dividends:Vanguard:VMMXX
--------------------
$-0.35
0.350 VMMXX
>>>2
=== 0