Commit graph

22 commits

Author SHA1 Message Date
Ruud van Asseldonk
6788256a85 Accept a new json-lines format in the CLI
I added a std.format_json function, and that required making the width
in the pretty-printer optional. With that in place, it is now easier to
support the JSON Lines format, something I wanted to do for some time
already.

This is a first step to accept the new format in the CLI. It does not
implement the formatting itself yet.
2025-06-28 22:17:01 +02:00
Ruud van Asseldonk
c51b77a59e Add 'rcl re' and 'rcl rq' shorthands for -fraw
This is somewhat common, especially when used as jq replacement, so
let's add a shorthand for them.
2024-08-23 22:14:41 +02:00
Ruud van Asseldonk
4aaab52879 Add CLI option to specify --banner in output
For the 'build' subcommand, I am adding a banner setting, so for
consistency, let's have it for all evaluation commands.
2024-07-13 12:57:34 +02:00
Ruud van Asseldonk
571906973d Make --color not apply when using --output 2024-02-20 20:52:14 +01:00
Ruud van Asseldonk
e73c564a81 Make the depfiles work with the output filenames
This is how Ninja can use them.
2024-02-20 20:52:14 +01:00
Ruud van Asseldonk
fd5e71699a Define --output-depfile option
I want to use Ninja for keeping repositories of files generated by RCL
up to date. But then Ninja needs to know when to rebuild. It can do this
with depfiles. I only need to generate them.
2024-02-20 20:52:14 +01:00
Ruud van Asseldonk
d88cbb2a83 Make --output respect --directory
I should really add a test for this too ... but goldens are not really
suitable for this. Let's leave it untested for now then?
2024-02-19 22:02:08 +01:00
Ruud van Asseldonk
b76e8d7a4b Document new output option 2024-02-19 21:30:10 +01:00
Ruud van Asseldonk
8513dca631 Rename --output to --format
I need --output to be able to specify an output file to write to. At
least, that is the common thing to call it. And also, I was calling the
format "format" already internally and in the docs. I think this is a
bit more logical.
2024-02-19 20:40:35 +01:00
Ruud van Asseldonk
13c214dbe0 Add yaml-stream output format
In some circles it is common to put multiple yaml documents in one file,
for example with Kubernetes manifests. You can already render a
Kubernetes manifest by just exporting as json, but then you can't do
these multi-document files. So add special support for that.

At some point it may be nice to output "friendlier" yaml, but I don't
want to go there at this point. The toml was messy enough already.
2024-02-19 19:02:41 +01:00
Ruud van Asseldonk
a7a47484ae Document TOML output format 2024-02-15 00:38:07 +01:00
Ruud van Asseldonk
ff7f022916 Add an --output=raw output format
I've needed this a few times, when I want to print a table from json
values. It's not too difficult to add. This implementation is somewhat
inefficient because it constructs and then formats an intermediate Doc
while it could print straight to stdout, but this does make the output
modes more uniform, and it makes it slightly easier to report errors
about non-formattable values. Also, the overhead is no worse than json
output, which so far has been fine for me if the document is not
humongous.
2023-12-21 23:00:32 +01:00
Ruud van Asseldonk
d689c225f0 Simplify stdin defaults
I just had an idea: instead of providing the state of stdin as an input
to the CLI parser, simplify the CLI parser (and tests) enormously by
removing that again, but instead, when it picks stdin as the file,
distinguish between "stdin (explictly)" and "stdin (default)".

Then in the input handling, I had another idea to make things simpler
without being a complete footgun to newcomers: default to stdin always,
regardless of whether stdin is a TTY. But, when stdin was chosen by
default and it is a TTY, print an informational message to stderr to
point out to users that we're waiting for input from stdin.
2023-12-17 22:37:10 +01:00
Ruud van Asseldonk
1aa2a776cd Document the new CLI behavior in the manual 2023-12-17 22:37:10 +01:00
Ruud van Asseldonk
1fdf14fa11 Add "je" shorthand for evaluating to json
If we have a "jq" for query --output=json, it makes sense to have "je"
as well, both for symmetry and convenience.
2023-11-22 23:57:55 +01:00
Ruud van Asseldonk
307dff3bab Implement filesystem sandbox for imports 2023-10-20 18:22:38 +02:00
Ruud van Asseldonk
9ceb7d5775 Define CLI parser for sandbox mode and includes 2023-10-17 22:58:51 +02:00
Ruud van Asseldonk
9df9d60b0e Write docs about how imports work
This also includes docs for the CLI for sandboxing modes, which at
this point are completely hypothetical, as well as relative and
workdir-relative import paths, which are also not implemented. One
might call it "readme-driven development".
2023-10-17 22:33:35 +02:00
Ruud van Asseldonk
131195ac8c Update docs to to match new CLI 2023-10-13 11:57:29 +02:00
Ruud van Asseldonk
f6814c3a6f Make CLI reference docs a bit briefer 2023-09-23 18:32:23 +02:00
Ruud van Asseldonk
f718f40cc0 Document all the CLI commands in the manual 2023-09-23 10:19:33 +02:00
Ruud van Asseldonk
cfb28ea614 Add shorthands for CLI commands 2023-09-23 10:14:53 +02:00