You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LogFilefunc(string) `long:"log-output" description:"redirect logs to file" value-name:"LOG-FILE"`
24
+
}
25
+
26
+
// Generate command to group all generator commands together
27
+
typeGeneratestruct {
28
+
Model*Model`command:"model"`
29
+
}
30
+
31
+
// Model is the generate model file command
32
+
typeModelstruct {
33
+
Optionsoptions
34
+
}
35
+
12
36
typeoptionsstruct {
13
37
Spec flags.Filename`long:"spec" short:"f" description:"the path to the OpenAPI spec file. It should be a local path in your file system" group:"shared"`
14
38
Crdbool`long:"crd" description:"if the spec file is a kubernetes CRD" group:"shared"`
@@ -18,9 +42,37 @@ type options struct {
18
42
DisableKeepSpecOrderbool`long:"disable-keep-spec-order" description:"disable to keep schema properties order identical to spec file"`
19
43
}
20
44
21
-
// Model is the generate model file command
22
-
typeModelstruct {
23
-
Optionsoptions
45
+
funcMain() {
46
+
parser:=flags.NewParser(&opts, flags.Default)
47
+
parser.ShortDescription="helps you to maintain your KCL API automatically"
48
+
parser.LongDescription=`kcl-openapi helps you to generate your KCL model code from OpenAPI spec or Kubernetes CRD.`
49
+
50
+
genpar, err:=parser.AddCommand("generate", "generate KCL code", "generate kcl code from the OpenAPI spec file", &Generate{})
51
+
iferr!=nil {
52
+
log.Fatalln(err)
53
+
}
54
+
for_, cmd:=rangegenpar.Commands() {
55
+
switchcmd.Name {
56
+
case"model":
57
+
cmd.ShortDescription="generate KCL models from OpenAPI spec"
0 commit comments