Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RemoteSourceDetectors = []Detector{ new(GitHubDetector), new(GitDetector), new(BitBucketDetector), new(GCSDetector), new(S3Detector), }
Functions ¶
func Detect ¶
Detect turns a source string into another source string if it is detected to be of a known pattern.
The third parameter should be the list of detectors to use in the order to try them. If you don't want to configure this, just use the global Detectors variable.
This is safe to be called with an already valid source string: Detect will just return it.
func SourceDirSubdir ¶
SourceDirSubdir takes a source URL and returns a tuple of the URL without the subdir and the subdir.
ex:
dom.com/path/?q=p => dom.com/path/?q=p, "" proto://dom.com/path//*?q=p => proto://dom.com/path?q=p, "*" proto://dom.com/path//path2?q=p => proto://dom.com/path?q=p, "path2"
func SubdirGlob ¶
SubdirGlob returns the actual subdir with globbing processed.
dst should be a destination directory that is already populated (the download is complete) and subDir should be the set subDir. If subDir is an empty string, this returns an empty string.
The returned path is the full absolute path.
Types ¶
type BitBucketDetector ¶
type BitBucketDetector struct{}
BitBucketDetector implements Detector to detect BitBucket URLs and turn them into URLs that the Git or Hg Getter can understand.
type Detector ¶
type Detector interface { // Detect will detect whether the string matches a known pattern to // turn it into a proper URL. Detect(string) (string, bool, error) }
Detector defines the interface that an invalid URL or a URL with a blank scheme is passed through in order to determine if its shorthand for something else well-known.
type GCSDetector ¶
type GCSDetector struct{}
GCSDetector implements Detector to detect GCS URLs and turn them into URLs that the GCSGetter can understand.
type GitDetector ¶
type GitDetector struct{}
GitDetector implements Detector to detect Git SSH URLs such as git@host.com:dir1/dir2 and converts them to proper URLs.
type GitHubDetector ¶
type GitHubDetector struct{}
GitHubDetector implements Detector to detect GitHub URLs and turn them into URLs that the Git Getter can understand.
type S3Detector ¶
type S3Detector struct{}
S3Detector implements Detector to detect S3 URLs and turn them into URLs that the S3 getter can understand.