Skip to content

Commit 1c23226

Browse files
author
Test
committed
Add version command and --version flag
- Add 'gt version' command - Add --version and -v flags - Fix CI build verification
1 parent 25b9a54 commit 1c23226

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cmd/gptcode/main.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ func main() {
3333
}
3434
}
3535

36+
var version = "dev"
37+
38+
var versionCmd = &cobra.Command{
39+
Use: "version",
40+
Short: "Print version information",
41+
Run: func(cmd *cobra.Command, args []string) {
42+
fmt.Printf("GPTCode version %s\n", version)
43+
},
44+
}
45+
46+
func init() {
47+
rootCmd.Version = version
48+
rootCmd.SetVersionTemplate("GPTCode version {{.Version}}\n")
49+
}
50+
3651
var rootCmd = &cobra.Command{
3752
Use: "gptcode",
3853
Short: "GPTCode – AI Coding Assistant with Specialized Agents",
@@ -152,6 +167,7 @@ func init() {
152167
}
153168

154169
rootCmd.AddCommand(setupCmd)
170+
rootCmd.AddCommand(versionCmd)
155171
setupCmd.Flags().BoolP("yes", "y", false, "Use Quick Start (non-interactive)")
156172
rootCmd.AddCommand(keyCmd)
157173
rootCmd.AddCommand(releaseCmd)

0 commit comments

Comments
 (0)