summaryrefslogtreecommitdiff
path: root/run.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-06 22:21:03 +0300
committerGitHub <[email protected]>2017-05-06 22:21:03 +0300
commitc26ef096c7990a5ae97b503545fd76ff6df388d6 (patch)
treed0180b667269b985d15520f3b2e1aafc9292af6e /run.go
parent2b6aed2b1e974a733c0dc614a9617c33a54c208c (diff)
parent404634e843081e7010260bd95006b84d6c40a8fd (diff)
Merge pull request #4 from posener/doc
Doc
Diffstat (limited to 'run.go')
-rw-r--r--run.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/run.go b/run.go
index bd9f662..90d0df4 100644
--- a/run.go
+++ b/run.go
@@ -1,9 +1,16 @@
+// Package complete provides a tool for bash writing bash completion in go.
+//
+// Writing bash completion scripts is a hard work. This package provides an easy way
+// to create bash completion scripts for any command, and also an easy way to install/uninstall
+// the completion of the command.
package complete
import (
"fmt"
"os"
"strings"
+
+ "github.com/posener/complete/cmd"
)
const (
@@ -16,7 +23,7 @@ const (
func Run(c Command) {
args, ok := getLine()
if !ok {
- runCommandLine(c.Name)
+ cmd.Run(c.Name)
return
}
Log("Completing args: %s", args)
@@ -35,7 +42,7 @@ func complete(c Command, args []string) (matching []string) {
// choose only matching options
l := last(args)
for _, option := range options {
- if option.Matches(l) {
+ if option.Match(l) {
matching = append(matching, option.String())
}
}