summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-12 20:20:30 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-12 20:20:30 -0400
commit71e8d506573fc61271e10fc3d02eea9a5eb8ba01 (patch)
tree9c0e3c0b27577771067f75ec42815aeef6732bd3
parent7610aec86df0fd5c49303a8ed984f16a0f0b1e1f (diff)
downloadfork-ledger-71e8d506573fc61271e10fc3d02eea9a5eb8ba01.tar.gz
fork-ledger-71e8d506573fc61271e10fc3d02eea9a5eb8ba01.tar.bz2
fork-ledger-71e8d506573fc61271e10fc3d02eea9a5eb8ba01.zip
gnuplot is supported again (-j and -J)
-rw-r--r--NEWS28
-rw-r--r--main.cc14
-rwxr-xr-xscripts/report10
3 files changed, 43 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 3d8e4e45..66baf8e1 100644
--- a/NEWS
+++ b/NEWS
@@ -3,8 +3,8 @@
* 2.0
-- The code base has been rewritten for clarity and consistency. The
- code is now simpler, more robust, and a fair bit faster.
+- The code base was rewritten for clarity and consistency. It is now
+ simpler, more robust, and faster.
- The most significant feature addition in this version is the use of
"value expressions". These are now used in many places to indicate
@@ -22,9 +22,33 @@
"-f" flag was seen (i.e., if the LEDGER environment variable is
used).
+- New "-o FILE" option will output data to the given FILE. If FILE is
+ "-", the output is the same as the default (stdout).
+
+- New -j and -J options replace the old -G (gnuplot) option. -j
+ reports the values column in a way gnuplot can consume, and -J
+ reports the totals column. An example can be found in
+ scripts/report.
+
- New "-y DATEFMT" options will change the date format used throughout
ledger. The default is "%Y/%m/%d".
+- New -Y and -W options prints yearly and weekly subtotals, just as
+ the -M option printed monthly subtotals in the previous version.
+
+- New "-z INTERVAL" allows for more flexible interval reporting. The
+ sublanguage used will probably mature over time, but for now it
+ supports expression like:
+
+ monthly
+ every week
+ every 3 quarters
+ weekly from 12/20
+
+ Note that when using the "from" date, this does not constrain the
+ report. It is only used for aligning report dates, for example if
+ you wish weekly reporting to start on Sundays.
+
- Regexps specified after the command name now apply to account names
only. To search on a payee, use "--" to separate the two kinds of
regexps. For example, to find a payee named "John" within all
diff --git a/main.cc b/main.cc
index a47be892..5b4de2f0 100644
--- a/main.cc
+++ b/main.cc
@@ -15,6 +15,8 @@ static const std::string bal_fmt = "%20T %2_%-n\n";
static const std::string reg_fmt
= "%D %-.20P %-.22N %12.66t %12.80T\n\
%/ %-.22N %12.66t %12.80T\n";
+static const std::string plot_value_fmt = "%D %t\n";
+static const std::string plot_total_fmt = "%D %T\n";
static const std::string print_fmt
= "\n%D %X%C%P\n %-34N %12o\n%/ %-34N %12o\n";
static const std::string equity_fmt
@@ -219,7 +221,7 @@ int main(int argc, char * argv[])
int c, index;
while (-1 !=
(c = getopt(argc, argv,
- "+ABb:Ccd:DEe:F:f:Ghi:L:l:MnOo:P:p:QRrS:sT:t:UVvWXYy:Zz:"))) {
+ "+ABb:Ccd:DEe:F:f:Ghi:JjL:l:MnOo:P:p:QRrS:sT:t:UVvWXYy:Zz:"))) {
switch (char(c)) {
// Basic options
case 'h':
@@ -435,6 +437,16 @@ int main(int argc, char * argv[])
total_expr = "MD(MT/(1+(((t-d)/(30*86400))<0?0:((t-d)/(30*86400)))))";
break;
+ case 'j':
+ value_expr = "S" + value_expr;
+ format_string = plot_value_fmt;
+ break;
+
+ case 'J':
+ total_expr = "S" + total_expr;
+ format_string = plot_total_fmt;
+ break;
+
default:
assert(0);
break;
diff --git a/scripts/report b/scripts/report
index c548792c..be90f896 100755
--- a/scripts/report
+++ b/scripts/report
@@ -1,17 +1,15 @@
-#!/bin/sh
-
-args=("$@")
-last=${args[`expr ${#args} - 3`]}
+#!/bin/bash
cd /tmp
-ledger "$@" | stripreg > $last
+ledger -j reg "$@" > report
gnuplot <<EOF
set terminal png
set output "report.png"
set xdata time
set timefmt "%Y/%m/%d"
-plot "$1" using 1:2 with linespoints
+plot "report" using 1:2 with linespoints
EOF
+rm -f report
open report.png