admin: Add link to forge
This commit is contained in:
parent
80917ae436
commit
2c76b5c7a3
7 changed files with 129 additions and 3 deletions
|
@ -2,9 +2,13 @@ package sync
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"net/url"
|
||||
"os"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var gitRemoteRe = regexp.MustCompile(`^(?:(?:git@|https://)([\w.@]+)(?:/|:))((?:[\w-_]+)/(?:[\w-_/]+))(?:.git){0,1}(?:(?:/){0,1})$`)
|
||||
|
||||
func countFileInDir(dirname string) (int, error) {
|
||||
files, err := os.ReadDir(dirname)
|
||||
if err != nil {
|
||||
|
@ -45,3 +49,11 @@ func (i GitImporter) stat(filename string) (os.FileInfo, error) {
|
|||
func (i GitImporter) Kind() string {
|
||||
return "git originated from " + i.Remote + " on " + i.li.Kind()
|
||||
}
|
||||
|
||||
func getForgeBaseLink(remote string) (u *url.URL, err error) {
|
||||
res := gitRemoteRe.FindStringSubmatch(remote)
|
||||
u, err = url.Parse(res[2])
|
||||
u.Scheme = "https"
|
||||
u.Host = res[1]
|
||||
return
|
||||
}
|
||||
|
|
Reference in a new issue