Commit Graph

245 Commits

Author SHA1 Message Date
antichris 4a17a04514
complete: enable complete.Complete() output capturing (#138)
* 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`
2021-04-06 06:46:20 +03:00
Eyal Posener 002575c9d5
Merge pull request #136 from antichris/gocomplete-let-tests-fail
gocomplete: do not suppress test failures
2021-04-01 10:52:49 +03:00
Chris Nobody bf9b51caf4 gocomplete: do not suppress test failures
Ensure that the components of the `testing` package that rely on calling
`os.Exit` remain functional and any test failures are actually reported
back after the `monkey.Patch` in the `gocomplete.Example` test.

Fix #135
2021-04-01 10:46:54 +03:00
Eyal Posener 5d9f7f10f0 Fix failing go1.16 test
Fixes #132
2021-01-30 11:13:29 +02:00
Chris Walz 246bd25c47
fix crash when COMP_POINT is greater than COMP_LINE size (#128)
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
2020-11-08 18:56:26 +02:00
Eyal Posener 5c05e978ea
Merge pull request #123 from posener/autogen
Use autogen to generate code
2020-05-10 06:06:40 +03:00
Eyal Posener 1f0264a9ce Use autogen 2020-05-10 06:04:42 +03:00
Goreadme 0b15fb4d6e Update readme according to Go doc 2020-05-09 11:18:46 +00:00
Eyal Posener be08f3c422
Merge pull request #122 from posener/gen
Autogenerate compflag code
2020-05-09 14:18:11 +03:00
Eyal Posener 41182b029c Autogenerate compflag code 2020-05-09 14:17:09 +03:00
Goreadme e6d850dd6b Update readme according to Go doc 2020-04-10 07:36:11 +00:00
Eyal Posener 95737120ac Better godoc badge 2020-04-10 10:35:27 +03:00
Goreadme a40e86b7ee Update readme according to Go doc 2020-04-09 19:06:10 +00:00
Eyal Posener 99e65b0bc5 remove goreadme badge 2020-04-09 22:05:26 +03:00
Goreadme 206739e66f Update readme according to Go doc 2020-04-09 18:35:26 +00:00
Eyal Posener b22f70f90a
Merge pull request #121 from posener/actions
Add github actions
2020-04-09 21:34:49 +03:00
Eyal Posener f929a1cfb4 Add github actions 2020-04-09 21:31:51 +03:00
Eyal Posener bcff2ec278 Update readme 2020-04-04 12:47:08 +03:00
Eyal Posener 1b58b8b755 Add installation instructions
Related to #120
2020-04-04 12:44:12 +03:00
Eyal Posener bdd345f079 Fix (un)installation failure detection 2020-01-03 14:42:15 +02:00
Eyal Posener 3627b98439 Add missing functions to flagset 2019-11-27 22:24:33 +02:00
Eyal Posener e63b7a9037 Use command line name instead of external name 2019-11-27 22:01:40 +02:00
Eyal Posener 85f1fe4e1d Add duration flag 2019-11-27 21:33:55 +02:00
Eyal Posener 8a431c416e Fix doc error 2019-11-27 21:21:30 +02:00
Eyal Posener 3ac431b3cc Update to script 1.0.4 2019-11-24 08:28:56 +02:00
Eyal Posener e8cb4f352f fix script change 2019-11-24 00:42:07 +02:00
Eyal Posener 85542e6d46 update readme 2019-11-23 12:30:12 +02:00
Eyal Posener ddaf561db3 Install: use script library 2019-11-23 12:14:56 +02:00
Eyal Posener 027a352502 Add forgoten option tests 2019-11-23 11:39:35 +02:00
Eyal Posener a138e3dfcf Options: added docs 2019-11-22 15:03:53 +02:00
Eyal Posener a48bf3f856 Options: add tests 2019-11-22 15:01:47 +02:00
Eyal Posener 0f93c0740c Fix nil completor 2019-11-22 11:48:06 +02:00
Eyal Posener e8bbd08d57 Extract flag options to predict package 2019-11-22 11:43:37 +02:00
Eyal Posener cf002b9a50 Fix completion of help when completing flags 2019-11-21 00:16:33 +02:00
Eyal Posener b05895fa6c fix references to complete 2019-11-20 22:52:44 +02:00
Eyal Posener 7881076092
Merge pull request #109 from posener/goreadme
readme: Update according to go doc
2019-11-19 06:32:58 +02:00
goreadme 90f09d9f81 Update readme according to go doc 2019-11-19 04:32:42 +00:00
Eyal Posener 3794f4987c Actually adding the install package 2019-11-19 05:28:26 +02:00
Eyal Posener c3bfbddfe6 Move install package back to project root 2019-11-19 05:17:52 +02:00
Eyal Posener ca6cedb614
Merge pull request #106 from posener/goreadme
readme: Update according to go doc
2019-11-18 07:30:20 +02:00
goreadme 345db24139 Update readme according to go doc 2019-11-18 05:30:00 +00:00
Eyal Posener dd939deef3 fix doc 2019-11-18 07:29:45 +02:00
Eyal Posener 7c7ab2f59a update module import path 2019-11-18 01:25:16 +02:00
Eyal Posener a7d83cca2f
Merge pull request #105 from posener/goreadme
readme: Update according to go doc
2019-11-18 01:10:34 +02:00
goreadme 49b2fcbf4b Update readme according to go doc 2019-11-17 23:10:11 +00:00
Eyal Posener 00c7945465
Merge pull request #104 from posener/v2
Complete v2
2019-11-18 01:10:06 +02:00
Eyal Posener 8724aaf183 V2 2019-11-18 01:05:47 +02:00
Eyal Posener 05b68ffc81
Merge pull request #103 from posener/gocomplete-mod
Remove gocomplete module files
2019-10-24 00:02:28 +03:00
Eyal Posener cee2ecb6a2 Remove gocomplete module files
Fixes #93
2019-10-23 23:07:15 +03:00
Eyal Posener 98a0c28ec7
Merge pull request #102 from posener/sub-cmd-bug
Fix off-by-one error for argument from method
2019-10-23 23:03:05 +03:00