summaryrefslogtreecommitdiff
path: root/complete.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-11 20:28:31 +0300
committerEyal Posener <[email protected]>2017-05-11 20:33:29 +0300
commit967bae76f3132c210e6275653f9b603593973858 (patch)
tree0f71371443e6d5dde4fcf9e49c63b9afbab28a55 /complete.go
parenta28594d28ea9a838f174641a411fd537c2c495b9 (diff)
Add Predictor interface
Diffstat (limited to 'complete.go')
-rw-r--r--complete.go16
1 files changed, 1 insertions, 15 deletions
diff --git a/complete.go b/complete.go
index 2780e62..be0876e 100644
--- a/complete.go
+++ b/complete.go
@@ -51,27 +51,13 @@ func (c *Complete) Run() bool {
a := newArgs(line)
- options := complete(c.Command, a)
+ options := c.Command.Predict(a)
Log("Completion: %s", options)
output(options)
return true
}
-// complete get a command an command line arguments and returns
-// matching completion options
-func complete(c Command, a args) (matching []string) {
- options, _ := c.predict(a)
-
- for _, option := range options {
- Log("option %T, %s -> %t", option, option, option.Match(a.beingTyped))
- if option.Match(a.beingTyped) {
- matching = append(matching, option.String())
- }
- }
- return
-}
-
func getLine() ([]string, bool) {
line := os.Getenv(envComplete)
if line == "" {