summaryrefslogtreecommitdiff
path: root/src/session.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-31 18:52:34 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-31 18:52:34 -0400
commit9d267fa1331a570e2b4c978f0b35a107a47b51c1 (patch)
treeed8c5bc7d5b3b2024fb4fee80f4ec86332fb277f /src/session.h
parent75daee6a5df8154ecd6011f93af746105529a13d (diff)
downloadfork-ledger-9d267fa1331a570e2b4c978f0b35a107a47b51c1.tar.gz
fork-ledger-9d267fa1331a570e2b4c978f0b35a107a47b51c1.tar.bz2
fork-ledger-9d267fa1331a570e2b4c978f0b35a107a47b51c1.zip
Inspired by Omari Norman, I've rewritten main.cc so it's easy to approach.
Diffstat (limited to 'src/session.h')
-rw-r--r--src/session.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/session.h b/src/session.h
index 852f3281..5a05d42c 100644
--- a/src/session.h
+++ b/src/session.h
@@ -71,12 +71,16 @@ class session_t : public noncopyable, public scope_t
public:
static session_t * current;
- scoped_ptr<report_t> current_report;
+ scoped_ptr<report_t> report;
- path data_file;
+ std::list<path> data_files;
+ bool next_data_file_from_command_line;
+ bool saw_data_file_from_command_line;
optional<path> init_file;
optional<path> cache_file;
- optional<path> price_db;
+ optional<path> price_db;
+ bool next_price_db_from_command_line;
+ bool saw_price_db_from_command_line;
string register_format;
string wide_register_format;
@@ -114,6 +118,11 @@ public:
session_t();
virtual ~session_t();
+ void now_at_command_line(const bool truth) {
+ next_data_file_from_command_line = truth;
+ next_price_db_from_command_line = truth;
+ }
+
journal_t * create_journal() {
journal_t * journal = new journal_t;
journals.push_back(journal);
@@ -243,11 +252,13 @@ See LICENSE file included with the distribution for details and disclaimer.\n";
value_t option_file_(call_scope_t& args) { // f
assert(args.size() == 1);
-
- // jww (2008-08-13): Add support for multiple files
- data_file = args[0].as_string();
- use_cache = false;
-
+ if (next_data_file_from_command_line &&
+ ! saw_data_file_from_command_line) {
+ data_files.clear();
+ use_cache = false;
+ saw_data_file_from_command_line = true;
+ }
+ data_files.push_back(args[0].as_string());
return true;
}
};