-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
103 lines (95 loc) · 2.23 KB
/
commands.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
package main
import (
"fmt"
"os"
"github.com/FINTLabs/fint-graphql-cli/classes"
"github.com/FINTLabs/fint-graphql-cli/generate"
"github.com/FINTLabs/fint-graphql-cli/packages"
"github.com/FINTLabs/fint-graphql-cli/branches"
"github.com/FINTLabs/fint-graphql-cli/tags"
"github.com/urfave/cli"
)
var GlobalFlags = []cli.Flag{
cli.StringFlag{
EnvVar: "GITHUB_OWNER",
Name: "owner",
Value: "FINTLabs",
Usage: "Git repository containing model",
},
cli.StringFlag{
EnvVar: "GITHUB_PROJECT",
Name: "repo",
Value: "fint-informasjonsmodell",
Usage: "Git repository containing model",
},
cli.StringFlag{
EnvVar: "MODEL_FILENAME",
Name: "filename",
Value: "FINT-informasjonsmodell.xml",
Usage: "File name containing information model",
},
cli.StringFlag{
EnvVar: "TAG_NAME",
Name: "tag, t",
Value: "latest",
Usage: "the tag (version) of the model to generate",
},
cli.BoolFlag{
EnvVar: "",
Name: "force, f",
Usage: "force downloading XMI for GitHub.",
},
}
var Commands = []cli.Command{
{
Name: "printClasses",
Usage: "list classes",
Action: classes.CmdPrintClasses,
Flags: []cli.Flag{},
},
{
Name: "generate",
Usage: "generates GraphQL schema, query resolvers, resolvers and services.",
Action: generate.CmdGenerate,
Flags: []cli.Flag{
cli.StringSliceFlag{
Name: "exclude, x",
Usage: "Classes to exclude from the generated schema and classes.",
},
cli.StringSliceFlag{
Name: "exclude-schema, xs",
Usage: "Classes to exclude from the generated schema and classes.",
},
},
},
{
Name: "listPackages",
Usage: "list Packages",
Action: packages.CmdListPackages,
Flags: []cli.Flag{},
},
/*
{
Name: "listNamespaces",
Usage: "list CS namespaces",
Action: namespaces.CmdListNamespaces,
Flags: []cli.Flag{},
},
*/
{
Name: "listTags",
Usage: "list tags",
Action: tags.CmdListTags,
Flags: []cli.Flag{},
},
{
Name: "listBranches",
Usage: "list branches",
Action: branches.CmdListBranches,
Flags: []cli.Flag{},
},
}
func CommandNotFound(c *cli.Context, command string) {
fmt.Fprintf(os.Stderr, "%s: '%s' is not a %s command. See '%s --help'.", c.App.Name, command, c.App.Name, c.App.Name)
os.Exit(2)
}