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 }