diff --git a/server.yaml b/server.yaml index a24a188961cef84ecee1da543b92e227619c74da_c2VydmVyLnlhbWw=..9f520041a3cc14320375bbaad4aaaa9f9185ccdb_c2VydmVyLnlhbWw= 100644 --- a/server.yaml +++ b/server.yaml @@ -67,6 +67,10 @@ target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd" file_name: custom_info.go skip_exists: true + - name: cmdVersion + source: server/cmdVersion.gotmpl + target: "{{ joinFilePath .Target \"cmd\" (dasherize (pascalize .Name)) }}/cmd" + file_name: version.go - name: configure source: server/configureapi.gotmpl target: "{{ joinFilePath .Target .ServerPackage }}" diff --git a/templates/server/cmdVersion.gotmpl b/templates/server/cmdVersion.gotmpl new file mode 100644 index 0000000000000000000000000000000000000000..9f520041a3cc14320375bbaad4aaaa9f9185ccdb_dGVtcGxhdGVzL3NlcnZlci9jbWRWZXJzaW9uLmdvdG1wbA== --- /dev/null +++ b/templates/server/cmdVersion.gotmpl @@ -0,0 +1,24 @@ +// Code generated by go-swagger/go-orusapi; DO NOT EDIT. + +package cmd + +import ( + "fmt" + + "{{ joinFilePath .TargetImportPath "restapi" }}" +) + +// VersionCmd is the "version" command +type VersionCmd struct{} + +// Execute the 'version' commands +func (cmd *VersionCmd) Execute([]string) error { + fmt.Println("{{ pascalize .Name }} " + restapi.GetVersion()) + return nil +} + +func init() { + if _, err := parser.AddCommand("version", "Print the program version", "", &VersionCmd{}); err != nil { + Logger.Fatal().Err(err).Msg("error adding command") + } +} diff --git a/templates/server/versionapi.gotmpl b/templates/server/versionapi.gotmpl index a24a188961cef84ecee1da543b92e227619c74da_dGVtcGxhdGVzL3NlcnZlci92ZXJzaW9uYXBpLmdvdG1wbA==..9f520041a3cc14320375bbaad4aaaa9f9185ccdb_dGVtcGxhdGVzL3NlcnZlci92ZXJzaW9uYXBpLmdvdG1wbA== 100644 --- a/templates/server/versionapi.gotmpl +++ b/templates/server/versionapi.gotmpl @@ -8,6 +8,8 @@ import ( "encoding/json" + "orus.io/orus-io/go-orusapi" + {{ imports .DefaultImports }} {{ imports .Imports }} )