Skip to content
Snippets Groups Projects
Commit 9f520041a3cc authored by Florent Aide's avatar Florent Aide
Browse files

add template for cmd/version.go

parent a24a188961ce
No related branches found
No related tags found
No related merge requests found
Pipeline #21698 passed
......@@ -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 }}"
......
// 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")
}
}
......@@ -8,6 +8,8 @@
import (
"encoding/json"
"orus.io/orus-io/go-orusapi"
{{ imports .DefaultImports }}
{{ imports .Imports }}
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment