-
Notifications
You must be signed in to change notification settings - Fork 28
/
main.go
68 lines (61 loc) · 1.39 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
package main
import (
"errors"
"log"
"os"
"github.com/Yamashou/gqlgenc/clientv2"
"github.com/nhost/cli/clienv"
"github.com/nhost/cli/cmd/config"
"github.com/nhost/cli/cmd/configserver"
"github.com/nhost/cli/cmd/dev"
"github.com/nhost/cli/cmd/dockercredentials"
"github.com/nhost/cli/cmd/project"
"github.com/nhost/cli/cmd/run"
"github.com/nhost/cli/cmd/secrets"
"github.com/nhost/cli/cmd/software"
"github.com/nhost/cli/cmd/user"
"github.com/urfave/cli/v2"
)
var Version string
func main() {
flags, err := clienv.Flags()
if err != nil {
panic(err)
}
app := &cli.App{ //nolint: exhaustruct
Name: "nhost",
EnableBashCompletion: true,
Version: Version,
Description: "Nhost CLI tool",
Commands: []*cli.Command{
config.Command(),
configserver.Command(),
dev.Command(),
dev.CommandUp(),
dev.CommandDown(),
dev.CommandLogs(),
dockercredentials.Command(),
project.CommandInit(),
project.CommandList(),
project.CommandLink(),
run.Command(),
secrets.Command(),
software.Command(),
user.CommandLogin(),
},
Metadata: map[string]any{
"Author": "Nhost",
"LICENSE": "MIT",
},
Flags: flags,
}
if err := app.Run(os.Args); err != nil {
var graphqlErr *clientv2.ErrorResponse
switch {
case errors.As(err, &graphqlErr):
log.Fatal(graphqlErr.GqlErrors)
case err != nil:
log.Fatal(err)
}
}
}