Unverified Commit 0ba4c0f3 authored by Johnny's avatar Johnny Committed by GitHub

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

parent f90d9a49
...@@ -92,6 +92,13 @@ var ( ...@@ -92,6 +92,13 @@ var (
<-ctx.Done() <-ctx.Done()
}, },
} }
versionCmd = &cobra.Command{
Use: "version",
Short: "Print the current Memos version",
Run: func(_ *cobra.Command, _ []string) {
fmt.Println(version.GetCurrentVersion())
},
}
) )
func init() { func init() {
...@@ -140,6 +147,8 @@ func init() { ...@@ -140,6 +147,8 @@ func init() {
viper.SetEnvPrefix("memos") viper.SetEnvPrefix("memos")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv() viper.AutomaticEnv()
rootCmd.AddCommand(versionCmd)
} }
func printGreetings(profile *profile.Profile) { func printGreetings(profile *profile.Profile) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment