Fix vet
This commit is contained in:
parent
c26ef096c7
commit
cc743aad8b
|
@ -10,6 +10,10 @@ type installer interface {
|
||||||
Uninstall(cmd, bin string) error
|
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 {
|
func Install(cmd string, asRoot bool) error {
|
||||||
bin, err := getBinaryPath()
|
bin, err := getBinaryPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -18,6 +22,10 @@ func Install(cmd string, asRoot bool) error {
|
||||||
return getInstaller(asRoot).Install(cmd, bin)
|
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 {
|
func Uninstall(cmd string, asRoot bool) error {
|
||||||
bin, err := getBinaryPath()
|
bin, err := getBinaryPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
2
match.go
2
match.go
|
@ -20,6 +20,7 @@ func (a MatchPrefix) String() string {
|
||||||
return string(a)
|
return string(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Match returns true if a has the prefix as prefix
|
||||||
func (a MatchPrefix) Match(prefix string) bool {
|
func (a MatchPrefix) Match(prefix string) bool {
|
||||||
return strings.HasPrefix(string(a), prefix)
|
return strings.HasPrefix(string(a), prefix)
|
||||||
}
|
}
|
||||||
|
@ -32,6 +33,7 @@ func (a MatchFileName) String() string {
|
||||||
return string(a)
|
return string(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Match returns true if prefix's abs path prefixes a's abs path
|
||||||
func (a MatchFileName) Match(prefix string) bool {
|
func (a MatchFileName) Match(prefix string) bool {
|
||||||
full, err := filepath.Abs(string(a))
|
full, err := filepath.Abs(string(a))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -27,9 +27,9 @@ func (p Predicate) predict(last string) []Matcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PredictNothing does not expect anything after.
|
// 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.
|
// or arbitrary name.
|
||||||
func PredictAnything(last string) []Matcher { return nil }
|
func PredictAnything(last string) []Matcher { return nil }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue