-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
49 lines (39 loc) · 1.07 KB
/
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
// Main CLI entrypoint.
package main
import (
"os"
"github.com/aws-observability/amazon-managed-grafana-migrator/internal/pkg/cli"
"github.com/aws-observability/amazon-managed-grafana-migrator/internal/pkg/log"
"github.com/spf13/cobra"
)
const (
shortDescription = "Amazon Managed Grafana migration utility"
version = "0.2.1"
)
var region string
func main() {
cmd := buildRootCmd()
if err := cmd.Execute(); err != nil {
log.Error(err.Error())
os.Exit(1)
}
}
func buildRootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "amazon-managed-grafana-migrator",
Short: shortDescription,
Example: `
Displays the help menu for the "migrate" command.
$ amazon-managed-grafana-migrator migrate --help
Discovers all the workspaces in the specified region.
$ amazon-managed-grafana-migrator discover --region eu-west-1
`,
SilenceUsage: true,
SilenceErrors: true,
}
cmd.Version = version
cmd.AddCommand(cli.BuildDiscoverCmd())
cmd.AddCommand(cli.BuildMigrateCmd())
cmd.PersistentFlags().StringVarP(®ion, "region", "r", "", "AWS Region")
return cmd
}