-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
49 lines (39 loc) · 898 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
41
42
43
44
45
46
47
48
49
package main
import (
"flag"
"fmt"
"os"
"github.com/PatrickMenoti/poc-graphql/options"
)
var tokenvalue string
func main() {
fmt.Println("Select an option:")
fmt.Println("1. Top status codes")
fmt.Println("2. Top user agent")
fmt.Println("3. Total requests")
var choice int
fmt.Print("Enter your choice: ")
_, err := fmt.Scan(&choice)
if err != nil {
fmt.Println("Error reading input:", err)
os.Exit(1)
}
flag.StringVar(&tokenvalue, "token", "", "API token for authorization")
// Parse the command-line flags
flag.Parse()
// Check if the token is provided
if tokenvalue == "" {
fmt.Println("Please provide a valid API token using the -token flag.")
return
}
switch choice {
case 1:
options.Option1(tokenvalue)
case 2:
options.Option2(tokenvalue)
case 3:
options.Option3(tokenvalue)
default:
fmt.Println("Invalid choice. Please enter 1 or 2.")
}
}