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
Allow filter to be specified on command line
This makes ijq usage match jq more closely. Consider the following
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
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` .
Fix asset name in README example
Read initial filter from file with -f flag
Update installation instructions in README
Add command to print version
Strip binary to reduce file size
Print filter to stderr on exit
Update asciicast url in README
Error if no data on stdin when trying to read
Add commandline flags to pass through to jq