Skip to content

Commit 0311787

Browse files
authored
minor: add version info (#57)
1 parent 6e77a1e commit 0311787

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/cmds/kcl-openapi.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"github.com/jessevdk/go-flags"
1414
)
1515

16+
const version = "0.5.0"
17+
1618
func init() {
1719
loads.AddLoader(fmts.YAMLMatcher, fmts.YAMLDoc)
1820
}
@@ -21,6 +23,7 @@ var opts struct {
2123
// General options applicable to all commands
2224
Quiet func() `long:"quiet" short:"q" description:"silence logs"`
2325
LogFile func(string) `long:"log-output" description:"redirect logs to file" value-name:"LOG-FILE"`
26+
Version func() `long:"version" short:"v" description:"print the version of kcl-openapi"`
2427
}
2528

2629
// Generate command to group all generator commands together
@@ -58,7 +61,10 @@ func Main() {
5861
cmd.LongDescription = cmd.ShortDescription
5962
}
6063
}
61-
64+
opts.Version = func() {
65+
println("kcl-openapi", version)
66+
os.Exit(0)
67+
}
6268
opts.Quiet = func() {
6369
log.SetOutput(ioutil.Discard)
6470
}

0 commit comments

Comments
 (0)