I am having trouble executing ledger commands.
The issue is that "register" commands do not return.
Ledger starts rendering the transactions, but once it get's half way
through, it stops with a last ":" colon sign.
Escaping from there only works with Ctrl+Z.
It accepts a log file name, and writes something to it. The content of
this log file does not seem to be informative.
When I do other commands like "balance" it works fine.
It seems to have something to do with the length of the report and the
size of the terminal.
If the length is too long, it stops.
If I maximize the terminal, it stops later.
Haven't seen this before, so I am not sure whether this is strictly
related to ledger, or not...
The point is, I would like to know what is causing this?
Is it a problem in the ledger file format?
How can I pinpoint the issue?
I am using ledger compiled from GitHub (I think from the master branch)
on Ubuntu 11.10.
Regards, Stefan Tunsch
> How can I pinpoint the issue?
I would build with debug info, and use the --verify option.
After that, run your same command (before --verify) with "valgrind" in front
of the command.
John
Not sure what's happening here.
Or is this supposed to be like this?
Regards, Stefan Tunsch
El 04/04/12 11:53, John Wiegley escribi�:
Valgrind and debug don't give me any hint.
But I now see that when the output is longer than the terminal window size, I end up in a vi-like interface, or maybe in vi, where "q" quits the process, and pagedown let's me see the missing info.
Not sure what's happening here.
Or is this supposed to be like this?
Regards, Stefan Tunsch
El 04/04/12 11:53, John Wiegley escribió:
I would build with debug info, and use the --verify option.How can I pinpoint the issue?Stefan Tunsch<stunsch-Re5JQEe...@public.gmane.org> writes:
After that, run your same command (before --verify) with "valgrind" in front
of the command.
John
> I should add that if you redirect ledgers output to a file it doesn't page.
> It only does that when printing to stdout.
Or a bit more accurately: it only does that when displaying to a tty. If you
pipe the output to another program, it doesn't invoke the pager then either.
John
But once you reach that limit, you hit the problem.
So, for example, if you have an account named
"Assets:Family:Budget:Vacation:Whatever" and this gets cropped to
something like "Assets:Family:Budget:Vac..." you cannot do a command
like "ledger register | grep Whatever".
I know this is a stupid example, but I guess you get the point.
What is the standard way to do this?
I know I can call ledger with python and execute a script on it.
I know I can use the xml option that will output the data in xml format,
without the cropping.
But what I would like is to be able to use something as simple as
piping, but without the cropping of lines.
Let's say for example I want to save the output to a file, it makes no
sense to have ledger crop the lines.
Regards, Stefan Tunsch
El 04/04/12 22:01, John Wiegley escribió:
What is the standard way to do this?
> What is the standard way to do this? I know I can call ledger with python
> and execute a script on it. I know I can use the xml option that will
> output the data in xml format, without the cropping.
Try using --account-width=999. That should effectively disable cropping for
only the account. --payee-width=999 will disable cropping for the Payee.
John
> If you want something easy to parse you could use some like this: ledger reg
> --format "|%(date) |%(payee) |%(account) |%(amount) \n%/|%\$3| %\$4 \n"
That's essentially the same as using the "org" report instead of the
"register" report, btw. There's also the "cvs" and "xml" reports for
script consumption.
John