bmatsuo / jqsh

An interactive wrapper to the jq command line utility
MIT License
23 stars 2 forks source link

Confusing behavior when jqsh pages output with no input stream. #23

Closed bmatsuo closed 10 years ago

bmatsuo commented 10 years ago

Commands like push, pop, write, etc. that cause jq output to be paged can be somewhat confusing when there is no input stream (e.g. right after startup). When the input is not set and jq is executed a warning should be produced to stderr (the warning should not be paged, but that is a technicality).

Note: IMHO, it is probably correct to run jq connected to the pager even with no input stream. This would be consistent because, replacing the pager with a user command, you would not want to skip execution of the pipe because the input (and hence jq output) streams are empty. Also jq may (currently or in the future) have a way to generate output when no input is present.

bmatsuo commented 10 years ago

There is now a warning before any "write" or "pipe -out" operation when no input exists. Note that there are several internal uses of these operations. So the change is pervasion and fixes all(?) the spots where this confusion can occur.

46642a7dc593ccd7cfb4889ec35fbf996ba4574d