Skip to content

Commit f55c950

Browse files
committed
added version command
1 parent 7468ef5 commit f55c950

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"golang.org/x/tools/imports"
2222
)
2323

24+
var version = "undefined"
25+
2426
const DEFAULT_TEMPLATE = `
2527
// DO NOT EDIT, auto generated by struct2interface
2628
@@ -163,6 +165,15 @@ func main() {
163165
},
164166
}
165167

168+
var versionCmd = &cobra.Command{
169+
Use: "version",
170+
Short: "Show version",
171+
Run: func(cmd *cobra.Command, args []string) {
172+
log.Printf("version: %s", version)
173+
},
174+
}
175+
176+
rootCmd.AddCommand(versionCmd)
166177
rootCmd.Flags().StringVarP(&folder, "folder", "f", "", "Path to the package in which the struct resides")
167178
_ = rootCmd.MarkFlagRequired("folder")
168179
rootCmd.Flags().StringVarP(&outputFile, "output", "o", "", "Path to output file (will be overwritten)")

0 commit comments

Comments
 (0)