bee support version command

This commit is contained in:
astaxie 2014-05-17 01:37:45 +08:00
parent 244f27afdf
commit 226b5d4f4d
2 changed files with 31 additions and 0 deletions

3
bee.go
View File

@ -25,6 +25,8 @@ import (
"strings" "strings"
) )
const version = "1.0.1"
type Command struct { type Command struct {
// Run runs the command. // Run runs the command.
// The args are the arguments after the command name. // The args are the arguments after the command name.
@ -78,6 +80,7 @@ var commands = []*Command{
cmdRouter, cmdRouter,
cmdTest, cmdTest,
cmdBale, cmdBale,
cmdVersion,
//cmdReStart, //cmdReStart,
} }

28
version.go Normal file
View File

@ -0,0 +1,28 @@
package main
import (
"fmt"
"github.com/astaxie/beego"
)
var cmdVersion = &Command{
UsageLine: "version",
Short: "show the bee & beego version",
Long: `
show the bee & beego version
bee version
bee: 1.1.1
beego: 1.2
`,
}
func init() {
cmdVersion.Run = versionCmd
}
func versionCmd(cmd *Command, args []string) {
fmt.Println("bee:" + version)
fmt.Println("beego:" + beego.VERSION)
}