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

superfluous output on stdout doesn't help programmatic usage #3

Closed
docteurklein opened this issue Sep 5, 2017 · 6 comments
Closed

Comments

@docteurklein
Copy link

docteurklein commented Sep 5, 2017

Summary

Having displayed

Success! Here's your token                                                                                                                                                  

on stdout seems superfluous. Maybe it shouldn't be displayed at all (or stderr at least), and should return 0 or 1 in case of success or failure respectively, thus following more the UNIX philosophy.

That would allow me to do stuff like:

TOKEN=$( jwt encode -S 'secret' -P role=todo_user)

Steps to reproduce

jwt encode -S 'secret' -P role=todo_user
Success! Here's your token
                                                                                                                                              
<SOME-TOKEN-OUTPUT>

Expected behavior

jwt encode -S 'secret' -P role=todo_user
<SOME-TOKEN-OUTPUT>

Thanks for this CLI! awesome.

@mike-engel
Copy link
Owner

Glad to hear you’re liking it! So I assume you’re trying to pipe the output or spawn a child process and intercept STDOUT? If so, I can go ahead and remove that or hide it behind a flag. I’ll have to check how rust sends exit codes though to emit a 0 on success. Thanks!

@mike-engel
Copy link
Owner

(Whoops didn’t see your example 😅)

@docteurklein
Copy link
Author

docteurklein commented Sep 5, 2017

thanks for the quick answer! I added the example afterwards, so that may be it :)

I tried to have a look at https://stackoverflow.com/a/30285110/244058 and https://doc.rust-lang.org/std/process/fn.exit.html and wanted to try a PR but I never edited rust code, so yeah.

@mike-engel
Copy link
Owner

No worries! If you’d like to attempt a PR, let me know and I’d be happy to review the PR. Otherwise, I’ll try and take care of it this week.

@mike-engel
Copy link
Owner

I'm stuck on a plane, so I went ahead and took care of this. 1.2.0 should resolve this with simplified output for encode, and explicit exit codes! Travis is a bit backed up on macOS builds right now if you need that, but linux and windows builds are up 😄

@docteurklein
Copy link
Author

@mike-engel awesome! thanks a lot :)

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