* complete: test capturing Complete() output
Implement an Example test to demonstrate capturing the output
of Complete(), which is crucial for integration tests.
* complete: do not hard-code the I/O streams at the package initialization
Instead of defining the input/output streams as unexported global vars
that only get their values assigned to once, at the very initialization
of the package, use the values that `os.Stdin` and `os.Stdout` have at
the particular moment on every `complete.Complete()` call.
Fix#137
* complete: capture and discard output in TestComplete
Restore earlier behavior using proper stream redirection this time.
* complete: output capturing example: define things in the package scope
Define the `stringLookup` func type and `promptEnv` func in the package
scope instead of the `ExampleComplete_outputCapturing` test.
* complete: rename the `stringLookup` func type to `getEnvFn`
Some shells (inexplicably) occasionally have a COMP_POINT that is greater than the COMP_LINE size. When that happens completion should be based on length of the COMP_LINE to avoid an out of bounds error.
See the original hack fix here: https://github.com/chriswalz/bit/blob/master/cmd/bitcomplete.go on line 39
This simplifies the prediction logic writing, the predictor
doesn't need to filter our according to line matching, instead
it returns everything and the filtering is done at the end.
This does not break current behavior.