On 02/08/23 19:34, Eric Altendorf wrote:
It doesn't appear that bean-query allows you to issue a `set` followed
by a query in a single line:
beanquery> set expand true; select balance where year=2018;
Invalid number of arguments.
When interactive, of course this is not important. However, being able
to do this would be useful for generating from the command line reports
with expand=true.
I looked into the code and it appears this happens because the `set`
command is handled by the interactive shell and is not part of the ebnf
grammar which is where semicolon-delimited statement sequences are
defined. The structure of the interactive shell also seems to be fairly
designed around interactivity, and handling statement sequences there
looks awkward.
Any other workarounds?
The beanquery interpreter does not handle multiple commands separated by
semicolons, it does not matter if these are BQL statements ore
meta-commands implemented by the shell. It is a known limitation but I
haven't had occasion to work on it yet.
The idea is that it should be possible to apply all settings that can be
applied interactively with 'set' also via command line arguments. But
this hasn't been implemented yet either.
The only work-around for not-interactive queries is to put the 'set'
meta-commands in the shell init file at ~/.config/beanquery/init
This is a thing that I've just implemented, thus you need a fairly
recent installation.
Cheers,
Dan
--
You received this message because you are subscribed to the Google Groups
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/ec80db1e-818c-70b3-b8b0-6ce9c29ce254%40grinta.net.