mirror of
https://github.com/teest114514/chatlog_alpha.git
synced 2026-03-22 10:48:23 +08:00
28 lines
536 B
Go
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))
|
|
}
|
|
},
|
|
}
|