summaryrefslogtreecommitdiff
path: root/src/precmd.cc
Commit message (Collapse)AuthorAgeFilesLines
* The Great Renaming, Part IIJohn Wiegley2009-02-231-8/+8
| | | | | The last commit did not contain the majority of changes because of a slight mishap. This contains the real changeset.
* Create a new interactive_t helper classJohn Wiegley2009-02-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of this class is much like Emacs' (interactive) form: it allows a value expression function to declare exactly how many arguments, and of what type, it intends to receive. It then offers type-safe access to theese arguments in a consistent manner. An example value expression function definition in C++: value_t fn_foo(call_scope_t& scope) { // We expect a string, an integer, and an optional date interactive_t args(scope, "sl&d"); std::cout << "String = " << args.get<string>(0) << "Integer = " << args.get<long>(1) << std::endl; if (args.has(2)) // was a date provided? std::cout << "Date = " << args.get<date_t>(2) << std::endl; return NULL_VALUE; } There is also an in_context_t<T> template, which finds the context type T in the current scope hierarchy. The in_context_t then also acts as a smart pointer to reference this context object, in addition to serving the same duty as interactive_t. This combination of intent is solely for the sake of brevity. value_t fn_bar(call_scope_t& scope) { in_context_t<account_t> env(scope, "sl&d"); std::cout << "Account name = " << env->fullname() << "String arg = " << env.get<string>(0) << std::endl; return NULL_VALUE; } As you can see here, 'env' acts as a smart pointer to the required context, and an object to extract the typed arguments.
* Added a --strict session optionJohn Wiegley2009-02-191-1/+1
| | | | | | | When enabled, if any accounts or commodities are seen in an uncleared transaction, which were not seen previously in a cleared or pending transaction or a textual directive dealing with accounts or commodities, a warning is generated about the unknown item.
* Strip annotations from the "parse" resultJohn Wiegley2009-02-151-1/+1
| | | | This way the value shown follows the current reporting options.
* Greatly improved output from the "format" commandJohn Wiegley2009-02-131-21/+43
| | | | | It now shows the formatted result against a sample entry, similar to what "parse" now does.
* Wired up the "entry" command from 2.x, though it still needs to be ported.John Wiegley2009-02-101-19/+0
|
* Break libledger_data's dependency on session_t.John Wiegley2009-02-091-0/+1
|
* For the "parse" pre-command, provide a sample transaction context.John Wiegley2009-02-091-4/+26
|
* Join command-line arguments before handling pre-commands.John Wiegley2009-02-091-26/+29
|
* Repaired the output of the "eval" command.John Wiegley2009-02-081-9/+16
|
* Correction to debug output.John Wiegley2009-02-071-1/+2
|
* Fixed the debug output of the pre-command "args".John Wiegley2009-02-071-3/+2
|
* Restored all the option handlers from 2.6.2, but not the options themselves.John Wiegley2009-02-061-1/+1
|
* Largely removed all of Ledger's use of global variables, for the REPL's sake.John Wiegley2009-02-041-3/+4
|
* Removed the binary caching code, and the XML, QIF and Gnucash parsers.John Wiegley2009-02-031-3/+0
|
* Moved the pre-commands to their own file, and created new "args" command.John Wiegley2009-02-011-0/+167