garabik / unicode

display unicode character properties
Other
65 stars 20 forks source link

Change maxcount message to be printed to stderr for better piping support #15

Closed bogn83 closed 3 years ago

bogn83 commented 4 years ago

First of all thanks for the unicode tool!

Before this commit one had the problem that when you want to pipe unicode output e.g. to the clipboard like so unicode --format="{pchar}" -m1 gear 2> /dev/null | xclip the error message was printed to stdout instead of the stderr which made it impossible to ignore the error and made the error message be part of the clipboard.

With this commit above command would only include the character.

Please note that I didn't test this and just used the GitHub editor.

bogn83 commented 4 years ago

Actually one could argument also for removing the message completely as the maxcount is something that the user explicitly chose to do and likely so to really only see the maxcount amount of chars and ignore every additional hit.

garabik commented 3 years ago

Applied in de1e14ba4c2b4ee7f78283ae4c5074ef225c3318 (devel branch). Note that stdout has to be flush()-ed because we are writing to sys.stdout.buffer and the message would be sometimes mixed with other output.