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

cache select always prints to STDERR #46

Closed
alphapapa opened this issue Apr 15, 2014 · 4 comments
Closed

cache select always prints to STDERR #46

alphapapa opened this issue Apr 15, 2014 · 4 comments

Comments

@alphapapa
Copy link

$ glyrc cache select lyrics -a "artist" -t "title" -w stdout --cache $HOME/.cache/glyrc 1>/dev/null

This prints data to STDERR.

$ glyrc cache select lyrics -a "artist" -t "title" -w stdout --cache $HOME/.cache/glyrc 1>/dev/null 2>&1

This prints nothing.

Seems to be because the cache query uses glyr_cache_print(), which doesn't get passed the output_path, and doesn't pass it on down.

As a result, cache queries don't obey -w/--write, while the lyrics getter does.

@sahib
Copy link
Owner

sahib commented Apr 15, 2014

Hi,

I'm afraid, I did not understand that. Maybe it's late, but did you meant to show another command in as the second one?

@alphapapa
Copy link
Author

Sorry, I didn't make it very clear, and GitHub's formatting doesn't help. :) The difference in the second command is that STDERR is redirected to STDOUT. The cache getter ignores -w and always writes to STDERR.

@sahib
Copy link
Owner

sahib commented Apr 17, 2014

Hi, this time I got it. I guess it was really late.

this should be done as of cf286b7.
Maybe I should add some clearing words: The output messages printed by glyr_cache_print() are not affected by --write. Those are always written to stderr and can be limited by --verbosity.

The output mechanism used by --write uses glyr_cache_write(), which should be used consistenly now. Therefore the following example will print the lyrics like the normal lyrics getter:

glyrc cache select lyrics -a "Akrea" -t "Trugbild" --cache $HOME/.cache/glyrc

while this would print only the lyrics on stdout, but no other messages:

glyrc cache select lyrics -a "Akrea" -t "Trugbild" --cache $HOME/.cache/glyrc -w stdout -v0

@alphapapa
Copy link
Author

Hi,

Thanks, that was fast. I'm still a bit confused about the last examples you gave, but if the cache getter behaves the same as the lyrics getter, I'm happy. :)

@sahib sahib closed this as completed Apr 19, 2014
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