CertainLach / jrsonnet

Rust implementation of Jsonnet language
MIT License
304 stars 33 forks source link

Support for stdin for --multi #151

Closed iilyak closed 6 months ago

iilyak commented 7 months ago

I would like to use jrsonnet as a tool which creates multiple files from stdin stream. However the multi flag doesn't support this feature.

{
  "first.rs": "pub fn foo() -> () {\n  println!(\"foo\");\n}",
  "second.rs": "pub fn bar() -> () {}"
}
❯ cat example.json | jrsonnet -m
error: a value is required for '--multi <MULTI>' but none was supplied

For more information, try '--help'.

❯ cat example.json | jrsonnet -m -
missing input argument

I provided an example.json here for demonstration purposes. However in my case it is an output of the shell pipe.

iilyak commented 6 months ago

It turned out that I didn't used the -m feature correctly. The following works as expected

❯ cat example.json | jrsonnet -S -m ttt -
ttt/first.rs
ttt/second.rs

The only improvement that could be made is improving an error message.