-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (34 loc) · 806 Bytes
/
main.go
File metadata and controls
41 lines (34 loc) · 806 Bytes
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
41
package main
import (
"fmt"
"os"
"strconv"
"dws-cli/auth"
"dws-cli/providers"
)
func main() {
fmt.Println("Welcome to DWS CLI!")
fmt.Println("Please choose your Git provider:")
fmt.Println("1. GitHub")
fmt.Println("2. GitLab")
fmt.Print("Enter your choice (1 or 2): ")
var input string
fmt.Scanln(&input)
choice, err := strconv.Atoi(input)
if err != nil || (choice != 1 && choice != 2) {
fmt.Println("Invalid choice. Please run the command again and select 1 or 2.")
os.Exit(1)
}
var provider auth.Provider
switch choice {
case 1:
provider = providers.NewGitHub()
case 2:
provider = providers.NewGitLab()
}
authManager := auth.NewAuthManager(provider)
if err := authManager.Authenticate(); err != nil {
fmt.Printf("Authentication failed: %v\n", err)
os.Exit(1)
}
}