File tree 6 files changed +56
-7
lines changed
6 files changed +56
-7
lines changed Original file line number Diff line number Diff line change 40
40
"enum" : [
41
41
" gitea" ,
42
42
" github" ,
43
- " gitlab"
43
+ " gitlab" ,
44
+ " sourcehut"
44
45
]
45
46
},
46
47
"repoUrl" : {
Original file line number Diff line number Diff line change @@ -4,14 +4,16 @@ import "pkg.icikowski.pl/sets"
4
4
5
5
// Providers' names
6
6
const (
7
- ProviderGitea string = "gitea"
8
- ProviderGitHub string = "github"
9
- ProviderGitLab string = "gitlab"
7
+ ProviderGitea string = "gitea"
8
+ ProviderGitHub string = "github"
9
+ ProviderGitLab string = "gitlab"
10
+ ProviderSourcehut string = "sourcehut"
10
11
)
11
12
12
13
// AllProviders is a set of all providers' names
13
14
var AllProviders * sets.Set [string ] = sets .New (
14
15
ProviderGitea ,
15
16
ProviderGitHub ,
16
17
ProviderGitLab ,
18
+ ProviderSourcehut ,
17
19
)
Original file line number Diff line number Diff line change 23
23
"repoUrl" : " https://try.gitea.io/someuser/some-awesome-package" ,
24
24
"branch" : " staging" ,
25
25
"website" : " https://somesite.com/my-awesome-package"
26
+ },
27
+ {
28
+ "name" : " others" ,
29
+ "provider" : " sourcehut" ,
30
+ "repoUrl" : " https://git.sr.ht/~someuser/someotherpackage" ,
31
+ "branch" : " master"
26
32
}
27
33
]
28
34
}
Original file line number Diff line number Diff line change 17
17
repoUrl : " https://try.gitea.io/someuser/some-awesome-package"
18
18
branch : staging
19
19
website : " https://somesite.com/my-awesome-package"
20
+ - name : others
21
+ provider : sourcehut
22
+ repoUrl : " https://git.sr.ht/~someuser/someotherpackage"
23
+ branch : master
Original file line number Diff line number Diff line change @@ -8,9 +8,10 @@ import (
8
8
)
9
9
10
10
var all map [string ]providerGenerator = map [string ]providerGenerator {
11
- constants .ProviderGitea : newGiteaProvider ,
12
- constants .ProviderGitHub : newGithubProvider ,
13
- constants .ProviderGitLab : newGitlabProvider ,
11
+ constants .ProviderGitea : newGiteaProvider ,
12
+ constants .ProviderGitHub : newGithubProvider ,
13
+ constants .ProviderGitLab : newGitlabProvider ,
14
+ constants .ProviderSourcehut : newSourcehutProvider ,
14
15
}
15
16
16
17
func New (domain string , pkg config.Package ) (Provider , error ) {
Original file line number Diff line number Diff line change
1
+ package providers
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/Icikowski/vanitygen/config"
7
+ )
8
+
9
+ type sourcehutProvider struct {
10
+ baseProvider
11
+ }
12
+
13
+ // GetGoSourceTag implements Provider.
14
+ func (p * sourcehutProvider ) GetGoSourceTag () string {
15
+ return fmt .Sprintf (
16
+ "%s/%s %s %s/tree/%s/item{/dir} %s/tree/%s/item{/dir}/{file}#L{line}" ,
17
+ p .domain , p .name ,
18
+ p .repo ,
19
+ p .repo , p .branch ,
20
+ p .repo , p .branch ,
21
+ )
22
+ }
23
+
24
+ var _ Provider = & gitlabProvider {}
25
+
26
+ func newSourcehutProvider (domain string , pkg config.Package ) Provider {
27
+ return & sourcehutProvider {
28
+ baseProvider : baseProvider {
29
+ domain : domain ,
30
+ name : pkg .Name ,
31
+ repo : pkg .RepositoryURL ,
32
+ branch : pkg .Branch ,
33
+ },
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments