feat(cli): add version subcommand (#5731)

This commit is contained in:
Johnny 2026-03-18 08:41:34 +08:00 committed by GitHub
parent f90d9a49a7
commit 0ba4c0f397
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -92,6 +92,13 @@ var (
<-ctx.Done()
},
}
versionCmd = &cobra.Command{
Use: "version",
Short: "Print the current Memos version",
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(version.GetCurrentVersion())
},
}
)
func init() {
@ -140,6 +147,8 @@ func init() {
viper.SetEnvPrefix("memos")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv()
rootCmd.AddCommand(versionCmd)
}
func printGreetings(profile *profile.Profile) {