summaryrefslogtreecommitdiff
path: root/src/global.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-06 03:31:41 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-06 03:31:41 -0400
commitcf6babcf9048f7e9205b1bead4794d8e2e9e8d62 (patch)
tree38688d2cd2433517045a67d2ef3f2777ee335050 /src/global.h
parentecc5a1aab50d57e65b654ea9f8a84f17208ca612 (diff)
downloadfork-ledger-cf6babcf9048f7e9205b1bead4794d8e2e9e8d62.tar.gz
fork-ledger-cf6babcf9048f7e9205b1bead4794d8e2e9e8d62.tar.bz2
fork-ledger-cf6babcf9048f7e9205b1bead4794d8e2e9e8d62.zip
Restored all the option handlers from 2.6.2, but not the options themselves.
Diffstat (limited to 'src/global.h')
-rw-r--r--src/global.h44
1 files changed, 35 insertions, 9 deletions
diff --git a/src/global.h b/src/global.h
index 9b9805a6..230fcb51 100644
--- a/src/global.h
+++ b/src/global.h
@@ -51,7 +51,14 @@ public:
global_scope_t(char ** envp);
~global_scope_t();
- void read_journal_files();
+ void read_init();
+ void read_journal_files();
+ void read_environment_settings(char * envp[]);
+ strings_list read_command_arguments(scope_t& scope, strings_list args);
+ void normalize_session_options();
+ function_t look_for_precommand(scope_t& scope, const string& verb);
+ function_t look_for_command(scope_t& scope, const string& verb);
+ void normalize_report_options(const string& verb);
char * prompt_string();
@@ -92,22 +99,41 @@ public:
return true;
}
+ void show_version_info(std::ostream& out) {
+ out <<
+ "Ledger " << ledger::version << ", the command-line accounting tool";
+ out <<
+ "\n\nCopyright (c) 2003-2009, John Wiegley. All rights reserved.\n\n\
+This program is made available under the terms of the BSD Public License.\n\
+See LICENSE file included with the distribution for details and disclaimer.";
+ out << std::endl;
+ }
+
+ virtual expr_t::ptr_op_t lookup(const string& name);
+
OPTION(global_scope_t, debug_);
+
+ OPTION__
+ (global_scope_t, init_file_,
+ CTOR(global_scope_t, init_file_) {
+ if (const char * home_var = std::getenv("HOME"))
+ on((path(home_var) / ".ledgerrc").string());
+ else
+ on(path("./.ledgerrc").string());
+ });
+
OPTION(global_scope_t, script_);
OPTION(global_scope_t, trace_);
OPTION(global_scope_t, verbose);
OPTION(global_scope_t, verify);
- virtual expr_t::ptr_op_t lookup(const string& name);
+ OPTION_(global_scope_t, version, DO() {
+ parent->show_version_info(std::cout);
+ throw int(0); // exit immediately
+ });
};
-void handle_debug_options(int argc, char * argv[]);
-void read_environment_settings(report_t& report, char * envp[]);
-strings_list read_command_arguments(scope_t& scope, strings_list args);
-void normalize_session_options(session_t& session);
-function_t look_for_precommand(scope_t& scope, const string& verb);
-function_t look_for_command(scope_t& scope, const string& verb);
-void normalize_report_options(report_t& report, const string& verb);
+void handle_debug_options(int argc, char * argv[]);
} // namespace ledger