Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

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

Johnny0ba4c0f397c5
diff --git a/cmd/memos/main.go b/cmd/memos/main.go
index e9ea35153..bf0a67373 100644
--- a/cmd/memos/main.go
+++ b/cmd/memos/main.go
@@ -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) {