-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
113 lines (105 loc) · 2.48 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package main
import (
"context"
"fmt"
"github.com/tokamak-network/trh-sdk/pkg/scanner"
"log"
"os"
"github.com/tokamak-network/trh-sdk/commands"
"github.com/tokamak-network/trh-sdk/flags"
"github.com/urfave/cli/v3"
)
func main() {
cmd := &cli.Command{
Name: "tokamak-sdk-cli",
Usage: "make an explosive entrance",
Action: func(ctx context.Context, cmd *cli.Command) error {
return nil
},
Commands: []*cli.Command{
{
Name: "deploy-contracts",
Usage: "Deploy contracts",
Flags: flags.DeployContractsFlag,
Action: commands.ActionDeployContracts(),
},
{
Name: "deploy",
Usage: "Deploy infrastructure",
Action: commands.ActionDeploy(),
},
{
Name: "dependencies",
Usage: "Dependencies",
Commands: []*cli.Command{
{
Name: "setup",
Usage: "Install the dependencies",
Action: func(ctx context.Context, cmd *cli.Command) error {
fmt.Println("Install the dependencies...")
fmt.Print("Would you like to install dependencies? (y/N): ")
choose, err := scanner.ScanBool()
if err != nil {
return err
}
if choose {
fmt.Println("Installing dependencies...")
// Add installation logic here
dependenciesCmd := commands.Dependencies{}
return dependenciesCmd.Install(cmd.Args().Slice())
} else {
fmt.Println("Installation skipped.")
}
return nil
},
},
{
Name: "check",
Usage: "remove an existing template",
Action: func(ctx context.Context, cmd *cli.Command) error {
dependenciesCmd := commands.Dependencies{}
dependenciesCmd.Check(cmd.Args().Slice())
return nil
},
},
},
},
{
Name: "destroy",
Usage: "Destroy infrastructure",
Action: commands.ActionDestroyInfra(),
},
{
Name: "install",
Usage: "Install plugins",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "plugins",
Usage: "",
Value: "",
},
&cli.StringFlag{
Name: "stack",
Usage: "Tech stack",
Value: "",
},
},
Action: commands.ActionInstallPlugins(),
},
{
Name: "install",
Usage: "Install plugins",
ArgsUsage: "[plugins...]",
Action: commands.ActionInstallPlugins(),
},
{
Name: "version",
Usage: "SDK version",
Action: commands.ActionVersion(),
},
},
}
if err := cmd.Run(context.Background(), os.Args); err != nil {
log.Fatal(err)
}
}