-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from posener/refactor
Some refactorings
- Loading branch information
Showing
11 changed files
with
217 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
language: go | ||
sudo: false | ||
go: | ||
- 1.11 | ||
- tip | ||
- 1.12.x | ||
- 1.11.x | ||
- 1.10.x | ||
- 1.9 | ||
- 1.8 | ||
|
||
before_install: | ||
- go get -u -t ./... | ||
|
||
script: | ||
- GO111MODULE=on ./test.sh | ||
- go test -race -coverprofile=coverage.txt -covermode=atomic ./... | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
|
||
matrix: | ||
allow_failures: | ||
- go: tip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,39 @@ | ||
// Package match contains matchers that decide if to apply completion. | ||
// | ||
// This package is deprecated. | ||
package match | ||
|
||
import "strings" | ||
|
||
// Match matches two strings | ||
// it is used for comparing a term to the last typed | ||
// word, the prefix, and see if it is a possible auto complete option. | ||
// | ||
// Deprecated. | ||
type Match func(term, prefix string) bool | ||
|
||
// Prefix is a simple Matcher, if the word is it's prefix, there is a match | ||
// Match returns true if a has the prefix as prefix | ||
// | ||
// Deprecated. | ||
func Prefix(long, prefix string) bool { | ||
return strings.HasPrefix(long, prefix) | ||
} | ||
|
||
// File returns true if prefix can match the file | ||
// | ||
// Deprecated. | ||
func File(file, prefix string) bool { | ||
// special case for current directory completion | ||
if file == "./" && (prefix == "." || prefix == "") { | ||
return true | ||
} | ||
if prefix == "." && strings.HasPrefix(file, ".") { | ||
return true | ||
} | ||
|
||
file = strings.TrimPrefix(file, "./") | ||
prefix = strings.TrimPrefix(prefix, "./") | ||
|
||
return strings.HasPrefix(file, prefix) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.