Commit graph

532 commits

Author SHA1 Message Date
John Wiegley
cebc1da256 Restored the --invert option 2009-02-22 04:51:08 -04:00
John Wiegley
3c5b5fbc0a Fix for systems that don't build with gettext 2009-02-22 01:40:45 -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
8ca91c1196 Allow balance values to be compared < or > 0 2009-02-21 22:00:00 -04:00
John Wiegley
018c812fda Fixed a bug with interactive_t's arg validation 2009-02-21 21:58:53 -04:00
John Wiegley
c6d2420d09 Fixed an accumulator bug that was mangling errors 2009-02-21 21:57:55 -04:00
John Wiegley
b902894284 Added support for using GNU gettext 2009-02-21 20:21:13 -04:00
John Wiegley
66c5cd4427 Use a "format accumulator" for error strings
This makes it possible to internationalize strings while still using
I/O streams.  For example:

    std::cout << ACCUM(_("Hello to %1 and %2!") << "me" << "you")
              << std::endl;
2009-02-21 20:20:57 -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
067f512e94 The --help (-h, -H) options now visit the man page 2009-02-21 16:24:10 -04:00
John Wiegley
5c80c459cc Made --leeway a synonym for --price-exp 2009-02-21 14:31:54 -04:00
John Wiegley
6548da04cd Fixed another memory bug in by_payee_xacts 2009-02-21 04:12:10 -04:00
John Wiegley
aeea1cb3e1 Fixed a memory leak in value_t::storage_t 2009-02-21 03:48:02 -04:00
John Wiegley
7bede3ac76 Fixed the spelling of some option exceptions 2009-02-21 02:23:06 -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
a93111470d Greatly improved the way "weeks" are iterated 2009-02-21 02:10:02 -04:00
John Wiegley
4ff8087815 Restored the --deviation option 2009-02-21 00:48:12 -04:00
John Wiegley
4fe4a33bf8 Justify integers correctly when printing 2009-02-21 00:45:54 -04:00
John Wiegley
bfa2691583 Don't allow '-' as part of an identifier token 2009-02-21 00:45:04 -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
fc349389e3 Restored the --budget option 2009-02-20 23:12:23 -04:00
John Wiegley
8ed4f3562f Added more option baseline tests, enabled --dow 2009-02-20 19:36:28 -04:00
John Wiegley
96782df17c Enabled --current option 2009-02-20 19:10:34 -04:00
John Wiegley
9d9f526816 Strip amounts displayed in the csv report 2009-02-20 18:35:20 -04:00
John Wiegley
c87882076b Allow date and datetime values to be formatted into strings 2009-02-20 18:33:02 -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
e05f29bff0 Don't use auto-widths for widths explicitly given 2009-02-20 15:41:48 -04:00
John Wiegley
a181ac52d3 Corrected a column-wise formatting issue 2009-02-20 15:41:48 -04:00
John Wiegley
748a6008b3 When clocking out, call total_seconds() 2009-02-20 13:18:37 -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
f2f52066d2 Added a --strict session option
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.
2009-02-19 22:36:08 -04:00
John Wiegley
2694335e54 Simplify account total values before comparison
This way, if two account values are BALANCE types containing only a
single AMOUNT, then it will do the sorting comparison of the amounts --
since otherwise balances are ignored for the purposes of sorting.
2009-02-19 21:57:17 -04:00
John Wiegley
7fb328707c Fixed another sort issue 2009-02-19 17:27:05 -04:00
John Wiegley
45e93d5f31 Added some sort-related debugging code 2009-02-19 17:25:29 -04:00
John Wiegley
1d85e992ca A key fix to the ways accounts were sorted
Comparing integer < amount was doing the reverse comparison.
2009-02-19 17:20:36 -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
d67c9fee0f Added valexpr vars for accessing item position
- filename
 - beg_line
 - beg_pos
 - end_line
 - end_pos
2009-02-19 16:22:31 -04:00
John Wiegley
1c616f8626 If a transaction's total is null, return 0 instead 2009-02-19 15:51:14 -04:00
John Wiegley
3826cb1bee Re-enabled parsing of timelog data 2009-02-19 15:50:24 -04:00
John Wiegley
c7cffa36ad If a sorting value can't be found, report an error 2009-02-19 15:48:44 -04:00
John Wiegley
26ddb8343c Don't sort or subtotal xacts for account reports 2009-02-19 15:47:54 -04:00