mirror of
https://github.com/x-motemen/ghq.git
synced 2026-09-10 07:26:27 -04:00
s/ NewURL/ newURL/g
This commit is contained in:
parent
11867e6177
commit
c9eeabd030
|
|
@ -170,7 +170,7 @@ func doGet(c *cli.Context) error {
|
|||
}
|
||||
}
|
||||
|
||||
url, err := NewURL(argURL)
|
||||
url, err := newURL(argURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ func doList(c *cli.Context) error {
|
|||
}
|
||||
} else {
|
||||
if hasSchemePattern.MatchString(query) || scpLikeURLPattern.MatchString(query) {
|
||||
if url, err := NewURL(query); err == nil {
|
||||
if url, err := newURL(query); err == nil {
|
||||
if repo, err := LocalRepositoryFromURL(url); err == nil {
|
||||
query = repo.RelPath
|
||||
}
|
||||
|
|
@ -357,7 +357,7 @@ func doLook(c *cli.Context) error {
|
|||
}
|
||||
|
||||
if len(reposFound) == 0 {
|
||||
if url, err := NewURL(name); err == nil {
|
||||
if url, err := newURL(name); err == nil {
|
||||
repo, err := LocalRepositoryFromURL(url)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -415,7 +415,7 @@ func doImport(c *cli.Context) error {
|
|||
}
|
||||
|
||||
processLine := func(line string) error {
|
||||
url, err := NewURL(line)
|
||||
url, err := newURL(line)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not parse URL <%s>: %s", line, err)
|
||||
}
|
||||
|
|
|
|||
2
url.go
2
url.go
|
|
@ -18,7 +18,7 @@ var (
|
|||
looksLikeAuthorityPattern = regexp.MustCompile(`[A-Za-z0-9]\.[A-Za-z]+(?::\d{1,5})?$`)
|
||||
)
|
||||
|
||||
func NewURL(ref string) (*url.URL, error) {
|
||||
func newURL(ref string) (*url.URL, error) {
|
||||
if !hasSchemePattern.MatchString(ref) {
|
||||
if scpLikeURLPattern.MatchString(ref) {
|
||||
matched := scpLikeURLPattern.FindStringSubmatch(ref)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ func TestNewURL(t *testing.T) {
|
|||
if tc.setup != nil {
|
||||
defer tc.setup()()
|
||||
}
|
||||
repo, err := NewURL(tc.url)
|
||||
repo, err := newURL(tc.url)
|
||||
if err != nil {
|
||||
t.Errorf("error should be nil but: %s", err)
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ func TestConvertGitURLHTTPToSSH(t *testing.T) {
|
|||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.url, func(t *testing.T) {
|
||||
httpsURL, err := NewURL(tc.url)
|
||||
httpsURL, err := newURL(tc.url)
|
||||
if err != nil {
|
||||
t.Errorf("error should be nil but: %s", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue