Closed williammartin closed 1 month ago
you can cp stdout some-file-path
, if that's what you mean.
Thanks for the quick response. It's not quite what I meant but maybe I can use it to achieve the same thing?
Is there an inbuilt mechanism for getting the contents of a file into something that can be passed as an argument to a command?
Not out of the box, but doing a "read file into env var" command is trivial: https://github.com/burrowers/garble/blob/48dd2263a90b67a2d3997f5b3b1b7cf537a35ea1/main_test.go#L142
Heh, yeh that's pretty much what I ended up writing as stdout2env
just now. Thanks very much for your help!
Arguably it could be provided out of the box, but there's a balance to be struck with bloating the API and docs with features :) In this case it is sometimes useful, but it is really a one-line function, so I think it's fine to leave out.
Totally understand. Mainly I just wondered if I was missing an obvious solution and I hadn't initially clocked that ts.ReadFile
handled the stdio cases.
Question
I'm exploring a test script that looks like:
You can see in the final section I hard code a
1
, indicating the Pull Request created has number1
. However, a more robust way to approach this in case of future parallelism would be to store the stdout of the previous command (which outputs the URL of the newly created PR).I know that there is a
stdin stdout
incantation but this doesn't quite work when:stdin
I had a look at the implementation for
env
but it doesn't seem to provide the same capability asstdin
.Perhaps the best thing for me to do is write a custom command but I guess I need to explore what is available in there. Am I missing something? Thanks!