Documentation
¶
Overview ¶
Package pkgurl contains functions for parsing remote urls
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindScpLikeComponents ¶
FindScpLikeComponents returns the user, host, port and path of the given SCP-like URL.
func IsLocalEndpoint ¶
IsLocalEndpoint returns true if the given URL string specifies a local file endpoint. For example, on a Linux machine, `/home/user/src/go-git` would match as a local endpoint, but `https://github.com/src-d/go-git` would not.
func IsRemoteEndpoint ¶
IsRemoteEndpoint returns true if the giver URL string specifies a remote endpoint. For example, on a Linux machine, `https://github.com/src-d/go-git` would match as a remote endpoint, but `/home/user/src/go-git` would not.
func MatchesScheme ¶
MatchesScheme returns true if the given string matches a URL-like format scheme.
func MatchesScpLike ¶
MatchesScpLike returns true if the given string matches an SCP-like format scheme.
Types ¶
type Parts ¶ added in v0.5.0
type Parts struct { GitUser string Host string Port string Path string // Fragment is the part of the URL after the hash (#) Fragment string Version string }
func (Parts) RepoOwnerAndName ¶ added in v0.5.0
RepoOwnerAndName returns the owner and name of the repository if the URL path contains at least two parts. Otherwise, it returns false.
Example:
- Path="hay-kot/scaffold-go-cli" => user="hay-kot", repo="scaffold-go-cli", ok=true
- Path="hay-kot" => user="", repo="", ok=false