summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-06 22:25:44 +0300
committerEyal Posener <[email protected]>2017-05-06 22:25:44 +0300
commitcc743aad8be84fa477d744e144c84ed75431ba3a (patch)
tree505482bd32b4d833299d28ac48f3963fd8492b69
parentc26ef096c7990a5ae97b503545fd76ff6df388d6 (diff)
Fix vet
-rw-r--r--cmd/install/install.go8
-rw-r--r--match.go2
-rw-r--r--predicate.go4
3 files changed, 12 insertions, 2 deletions
diff --git a/cmd/install/install.go b/cmd/install/install.go
index cef11f0..8f8ce9f 100644
--- a/cmd/install/install.go
+++ b/cmd/install/install.go
@@ -10,6 +10,10 @@ type installer interface {
Uninstall(cmd, bin string) error
}
+// Install complete command given:
+// cmd: is the command name
+// asRoot: if true the completion will be installed in /etc/bash_complete.d
+// otherwise the complete command will be added to the ~/.bashrc file.
func Install(cmd string, asRoot bool) error {
bin, err := getBinaryPath()
if err != nil {
@@ -18,6 +22,10 @@ func Install(cmd string, asRoot bool) error {
return getInstaller(asRoot).Install(cmd, bin)
}
+// Uninstall complete command given:
+// cmd: is the command name
+// asRoot: if true the completion will be removed from /etc/bash_complete.d
+// otherwise the complete command will be removed from the ~/.bashrc file.
func Uninstall(cmd string, asRoot bool) error {
bin, err := getBinaryPath()
if err != nil {
diff --git a/match.go b/match.go
index 7593d65..8da8f2c 100644
--- a/match.go
+++ b/match.go
@@ -20,6 +20,7 @@ func (a MatchPrefix) String() string {
return string(a)
}
+// Match returns true if a has the prefix as prefix
func (a MatchPrefix) Match(prefix string) bool {
return strings.HasPrefix(string(a), prefix)
}
@@ -32,6 +33,7 @@ func (a MatchFileName) String() string {
return string(a)
}
+// Match returns true if prefix's abs path prefixes a's abs path
func (a MatchFileName) Match(prefix string) bool {
full, err := filepath.Abs(string(a))
if err != nil {
diff --git a/predicate.go b/predicate.go
index a6746be..e377429 100644
--- a/predicate.go
+++ b/predicate.go
@@ -27,9 +27,9 @@ func (p Predicate) predict(last string) []Matcher {
}
// PredictNothing does not expect anything after.
-var PredictNothing Predicate = nil
+var PredictNothing Predicate
-// PredictNothing expects something, but nothing particular, such as a number
+// PredictAnything expects something, but nothing particular, such as a number
// or arbitrary name.
func PredictAnything(last string) []Matcher { return nil }