Initial commit

This commit is contained in:
2020-02-20 08:31:22 +01:00
commit b7bdd7bbea
17 changed files with 826 additions and 0 deletions

33
internal/project/local.go Normal file
View File

@ -0,0 +1,33 @@
package project
import (
"net/url"
"strings"
"gopkg.in/src-d/go-billy.v4"
)
const LocalScheme = "local"
const FileScheme = "file"
type LocalFetcher struct{}
func (f *LocalFetcher) Fetch(url *url.URL) (billy.Filesystem, error) {
return nil, nil
}
func (f *LocalFetcher) Match(url *url.URL) bool {
if url.Scheme == LocalScheme || url.Scheme == FileScheme {
return true
}
return isFilesystemPath(url.Path)
}
func NewLocalFetcher() *LocalFetcher {
return &LocalFetcher{}
}
func isFilesystemPath(path string) bool {
return strings.HasPrefix(path, "./") || strings.HasPrefix(path, "/")
}