Show usage when no arguments given
Update man page to reflect updated pane positions
Swap input and output view positions
Input on the left and output on the right has more a natural "flow" to
it, i.e. input comes in from the left, gets filtered, and comes out on
the right.
Don't crash if original filter is invalid
Instead of exiting the program, handle an invalid original filter the
same way as any other filter by making the text of the input box red.
Correctly handle -n option
When -n is passed, don't read any input and treat the first positional
argument (if it exists) as the filter.
Include man page and license in releases tarballs
Automatically upload new releases to sourcehut
Simplify debouncing code
Use the time.AfterFunc function which is a bit more straightforward.
This also solves a problem where the timeout code would execute when the
program launched, caused by the fact that a timer immediately starts
when it is created. This would cause the output view to be updated
before any input was entered, which resulted in incorrect output when a
custom filter string was entered.
Allow multiple files on command line
Each input file is concatenated to create the full input. This mirrors
jq's behavior.
Allow filter to be specified on command line
This makes ijq usage match jq more closely. Consider the following
cases:
1. A filter file is passed using the `-f` flag. In this case, all
positional arguments should be treated as input files. If no
arguments exist, read from stdin
2. Two or more arguments are passed. In this case, the first argument is
treated as the filter text and all remaining arguments are treated as
input files. No data is read from stdin, even if ijq is part of a
pipeline (this matches jq's behavior)
3. Exactly one argument is passed. If data is present on stdin, treat
the argument as a filter; otherwise, treat the argument as an input
data file
4. No arguments are passed. If data is present on stdin, start ijq with
the default filter; error otherwise.
Prefer log.Fatal over calling os.Exit manually
Update asset filename in README
Debounce filter input
Entering input too quickly (e.g. holding a single key) causes array
indexing errors in the tview library. This is most likely a concurrency
issue caused by a race condition on the `outputWriter` in the filter
input's asynchronous `ChangedFunc`.
My solution to this problem is to debounce the filter input so that the
filter is only executed at most every millisecond. This causes a
noticeable amount of input latency when a single key is held down, but
it's better than the program crashing.
Remove superfluous example in README
Use canonical Makefile variable names
Makefile conventions use lowercase for `prefix` and `bindir`, as well as
`install -d` over `mkdir -p` [1].
[1]: https://www.gnu.org/software/make/manual/html_node/Makefile-Conventions.html#Makefile-Conventions