Files
chatlog2/cmd/chatlog/cmd_version.go
2025-03-19 13:11:09 +08:00

28 lines
536 B
Go

package chatlog
import (
"fmt"
"github.com/sjzar/chatlog/pkg/version"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(versionCmd)
versionCmd.Flags().BoolVarP(&versionM, "module", "m", false, "module version information")
}
var versionM bool
var versionCmd = &cobra.Command{
Use: "version [-m]",
Short: "Show the version of chatlog",
Run: func(cmd *cobra.Command, args []string) {
if versionM {
fmt.Println(version.GetMore(true))
} else {
fmt.Printf("chatlog %s\n", version.GetMore(false))
}
},
}