-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (29 loc) · 869 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"context"
"github.com/costa86/github-automator/forms"
"github.com/costa86/github-automator/gh"
"github.com/google/go-github/v63/github"
)
func createRepoWrapper(ctx context.Context, client *github.Client) {
repo := forms.CreateRepoForm()
repoUrl := gh.CreateRepo(client, ctx, repo)
forms.RunGitCommands(repo.Folder, repoUrl)
}
func deleteRepoWrapper(ctx context.Context, client *github.Client) {
repos := gh.GetRepos(ctx, client)
selectedRepo := forms.DeleteRepoForm(repos)
confirmation := forms.DeleteRepoConfirmForm(selectedRepo)
if confirmation {
gh.DeleteRepo(ctx, client, selectedRepo)
}
}
func main() {
client, context := gh.GetClientAndContext()
switch forms.GetOperation() {
case forms.Delete.String():
deleteRepoWrapper(context, client)
case forms.Create.String():
createRepoWrapper(context, client)
}
}