summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/session.cc b/src/session.cc
index e5425a50..b0d31be9 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2013, John Wiegley. All rights reserved.
+ * Copyright (c) 2003-2015, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -93,25 +93,31 @@ std::size_t session_t::read_data(const string& master_account)
acct = journal->find_account(master_account);
optional<path> price_db_path;
- if (HANDLED(price_db_)){
+ if (HANDLED(price_db_)) {
price_db_path = resolve_path(HANDLER(price_db_).str());
- if (!exists(price_db_path.get())){
+ if (!exists(price_db_path.get())) {
throw_(parse_error, _f("Could not find specified price-db file %1%") % price_db_path);
}
} else {
- if (const char * home_var = std::getenv("HOME")){
+ if (const char * home_var = std::getenv("HOME")) {
price_db_path = (path(home_var) / ".pricedb");
} else {
price_db_path = ("./.ledgerrc");
}
}
+ if (HANDLED(day_break))
+ journal->day_break = true;
+
+ if (HANDLED(recursive_aliases))
+ journal->recursive_aliases = true;
+ if (HANDLED(no_aliases))
+ journal->no_aliases = true;
+
if (HANDLED(explicit))
journal->force_checking = true;
if (HANDLED(check_payees))
journal->check_payees = true;
- if (HANDLED(day_break))
- journal->day_break = true;
if (HANDLED(permissive))
journal->checking_style = journal_t::CHECK_PERMISSIVE;
@@ -119,8 +125,9 @@ std::size_t session_t::read_data(const string& master_account)
journal->checking_style = journal_t::CHECK_ERROR;
else if (HANDLED(strict))
journal->checking_style = journal_t::CHECK_WARNING;
- else if (HANDLED(value_expr_))
- journal->value_expr = HANDLER(value_expr_).str();
+
+ if (HANDLED(value_expr_))
+ journal->value_expr = HANDLER(value_expr_).str();
#if HAVE_BOOST_SERIALIZATION
optional<archive_t> cache;
@@ -258,6 +265,11 @@ void session_t::close_journal_files()
amount_t::initialize();
}
+journal_t * session_t::get_journal()
+{
+ return journal.get();
+}
+
value_t session_t::fn_account(call_scope_t& args)
{
if (args[0].is_string())
@@ -344,12 +356,18 @@ option_t<session_t> * session_t::lookup_option(const char * p)
case 'm':
OPT(master_account_);
break;
+ case 'n':
+ OPT(no_aliases);
+ break;
case 'p':
OPT(price_db_);
else OPT(price_exp_);
else OPT(pedantic);
else OPT(permissive);
break;
+ case 'r':
+ OPT(recursive_aliases);
+ break;
case 's':
OPT(strict);
break;