Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write to stdout #159

Closed
bryanlarsen opened this issue Apr 16, 2019 · 6 comments
Closed

write to stdout #159

bryanlarsen opened this issue Apr 16, 2019 · 6 comments

Comments

@bryanlarsen
Copy link
Contributor

Is there any way to write to stdout rather than to files? Since jk is hermetic there's no reason to save the input, I can just stream it to kubectl apply -f -.

#93 is pretty much required for this to be useful, but works great.
#125 is related but a much bigger ask.

@dlespiau
Copy link
Member

Yes!

$ cat stdout.js 
import std from '@jkcfg/std';


const o = {
  foo: 2,
  bar: [1, 2, 3],
};

std.write(o, '', { format: std.Format.YAML });

$ jk run stdout.js
bar:
- 1
- 2
- 3
foo: 2

@dlespiau
Copy link
Member

And with YAMLStream for multiple documents:

$ cat stdout.js 
import std from '@jkcfg/std';


const o = {
  foo: 2,
  bar: [1, 2, 3],
};

std.write([o, o], '', { format: std.Format.YAMLStream });

$ jk run stdout.js
bar:
- 1
- 2
- 3
foo: 2
---
bar:
- 1
- 2
- 3
foo: 2

@bryanlarsen
Copy link
Contributor Author

Thanks! I tried '-', but didn't think to try ''.

@bryanlarsen
Copy link
Contributor Author

Any chance of a release soon? I ended up using YAMLStream and #135 and having co-workers download an unreleased version is a little bit icky. :)

@dlespiau
Copy link
Member

Yes, can do, probably tomorrow though if that's ok.

@dlespiau
Copy link
Member

Done! released 0.2.4

@alexec alexec mentioned this issue Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants