Commit graph

137 commits

Author SHA1 Message Date
John Wiegley
fb9af0f111 Removed the --totals option 2009-03-05 23:26:21 -04:00
John Wiegley
c11d325712 Reduced the #include dependency tree to a minimum 2009-03-04 23:53:43 -04:00
John Wiegley
eb45a0a4f4 Normalized how account totals are calculated 2009-03-03 17:08:11 -04:00
John Wiegley
4af1bfdde3 Allow special %{} formatting sequence
Although %(amount) inserts an item's amount, it only does exactly that.
There is no special consideration like stripping of lot details, or
reduction to the base commodity, etc.  For those things, and to make
sure it was display in red if negative, the canonical form would be:

  %(ansify_if(justify(scrub(amount), 12, -1, true), red if amount < 0))

You can now use the special %{} form as an alternate to this:

  %12{amount, red if amount < 0}

The two expand to the same underlying expression.
2009-03-03 15:06:15 -04:00
John Wiegley
de3bafc0d7 Made all the ANSI color names into valexpr names 2009-03-03 14:59:56 -04:00
John Wiegley
79acfc1647 Moved fn_false to be a non-member function 2009-03-03 13:53:12 -04:00
John Wiegley
478998b4e9 Added a "null" value for value expressions 2009-03-03 13:36:23 -04:00
John Wiegley
710e4792d1 Added a "show" report query term
Everything beyond the show modifies the --display predicate, and
everything before modifies the --limit predicate.
2009-03-02 22:33:43 -04:00
John Wiegley
ad42447475 Changed how comments are output to be more logical 2009-03-01 05:40:44 -04:00
John Wiegley
e6aae5a096 The generate report now implies --actual 2009-02-27 16:08:39 -04:00
John Wiegley
e02fe8d58f Allow --head to limit the entries generate creates 2009-02-27 16:01:33 -04:00
John Wiegley
38cf0e56f5 Added --lots-actual, to not print calc'd details 2009-02-27 15:45:21 -04:00
John Wiegley
6b62be59fb Added generate command, --seed, and GenerateTests 2009-02-27 03:58:43 -04:00
John Wiegley
f1795e628b Fixed bugs relating to sign and rounding of costs 2009-02-27 03:45:32 -04:00
John Wiegley
c49b98fc4c Added an --unround option, to show full precision 2009-02-27 03:04:05 -04:00
John Wiegley
c57c85c92f Changed the "truncate" valexpr func to "truncated" 2009-02-27 02:59:16 -04:00
John Wiegley
7e43b93782 Changed --exchange's short option from -x to -X 2009-02-25 13:52:17 -04:00
John Wiegley
ac8e27a4b8 Added a new --depth option 2009-02-25 01:15:53 -04:00
John Wiegley
0814c5a23f Added a new level of Python integration 2009-02-24 19:48:14 -04:00
John Wiegley
ecf03b96a7 Removed the largely useless --performance option 2009-02-24 03:47:23 -04:00
John Wiegley
944c63e6f2 The Great Renaming, Part II
The last commit did not contain the majority of changes because of a
slight mishap.  This contains the real changeset.
2009-02-23 19:07:30 -04:00
John Wiegley
f440fcd8b0 rounded() and quantity() act on the first value 2009-02-23 15:44:19 -04:00
John Wiegley
aff7b56673 Added get_at and is_seq valexpr functions
These are for dealing with sequences.
2009-02-23 15:27:06 -04:00
John Wiegley
9f53efbf5f Many fixes to both --market and --exchange 2009-02-23 01:51:23 -04:00
John Wiegley
de6de07bac Many fixes to --market and --exchange
Also, --exchange now accepted multiple, comma-separated commodities.
2009-02-22 22:23:02 -04:00
John Wiegley
ea75613760 --exchange option now accepts multiple commodities
They must be separated by a comma, and all whitespace is ignored.
2009-02-22 17:51:11 -04:00
John Wiegley
e124811d8a Added --exchange (-x) option
This is like -V, except it lets you specify the goal commodity to report
in terms of, for example:

    reg -x CAD
2009-02-22 04:51:11 -04:00
John Wiegley
04fd1ae24c Fixed the way values are justified for printing 2009-02-22 04:51:11 -04:00
John Wiegley
3e543d187c Changed --colors to --color, to match Git 2009-02-22 04:51:11 -04:00
John Wiegley
348aae7478 Removed unused --totals option
This option was for outputting <total> elements in 2.x's XML output.
2009-02-22 01:29:34 -04:00
John Wiegley
eb4aa87843 Added a new --colors option, for terminal fun
The following colors are applied in the balance and register reports:

    GREEN   To a date, if it occurs in the future
    BOLD    If a payee name relates to an uncleared entry
    BLUE    For account names
    RED     For negative values
2009-02-21 22:04:01 -04:00
John Wiegley
a577e8c48e Added a new --raw option, for use with print 2009-02-21 19:45:13 -04:00
John Wiegley
dc63429785 Removed an unused class: format_entries 2009-02-21 19:22:55 -04:00
John Wiegley
6b9c83b156 Use more general scrub valexpr function in formats 2009-02-21 19:05:30 -04:00
John Wiegley
1f39d4148e Create a new interactive_t helper class
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.
2009-02-21 18:49:43 -04:00
John Wiegley
5c80c459cc Made --leeway a synonym for --price-exp 2009-02-21 14:31:54 -04:00
John Wiegley
f4e13f3458 Added --start-of-week option, used with --weekly
For example, --start-of-week=monday can be used to report weeks that
begin on Mondays.
2009-02-21 02:20:08 -04:00
John Wiegley
13812346b6 Handle reporting widths that are too small 2009-02-21 02:17:03 -04:00
John Wiegley
d0ac3a2e4e Added a new --exact option
The purpose of this option is that usually when you do a --monthly
periodic report, you see dates ranges from the first day of each month,
to the last day.  With --exact, the first day of each range will be the
date of the first transaction found in that range, and likewise with the
end of the range.  Essentially it "contracts" the reported period dates
to reflect the exact begin and end dates.
2009-02-21 02:14:53 -04:00
John Wiegley
23725ffafb Restored --forecast, now also --forecast-while 2009-02-21 00:12:22 -04:00
John Wiegley
3c18d3054f Restored the --base option 2009-02-20 23:42:48 -04:00
John Wiegley
8ed4f3562f Added more option baseline tests, enabled --dow 2009-02-20 19:36:28 -04:00
John Wiegley
01d8d28024 Removed unused --cache option 2009-02-20 16:32:44 -04:00
John Wiegley
95a3788fa7 Restored the --basis option 2009-02-20 15:41:49 -04:00
John Wiegley
31feaad105 Added --no-total option
This simply omits the final total in the balance report, nothing more.
2009-02-20 15:41:49 -04:00
John Wiegley
c1b25fcf86 Rewrote the equity command, which is working again
The old implementation used an account formatter, and was very
specialized.  The new is done as a transaction filter, and works along
with everything else, eliminating bugs special to the equity report.
2009-02-20 02:53:54 -04:00
John Wiegley
9805abbf2b Allow for sorting of the balance report
Sorting is repeated at each level of the hierarchy, unless --flat was
specified in which case it applies to the entire applicable accounts
list.
2009-02-19 16:53:25 -04:00
John Wiegley
5b897a12fc Added a new --columns= option 2009-02-19 14:42:18 -04:00
John Wiegley
39bdbbe053 The sequence -M -p 2004 now equals -p 2004 -M 2009-02-19 14:26:08 -04:00
John Wiegley
1f1a83c083 Restored the -j and -J options 2009-02-19 13:40:48 -04:00