7 Star 26 Fork 2

Gitee 极速下载 / goworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/xiaonanln/goworld
克隆/下载
main.go 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
seis 提交于 2018-02-12 15:46 . rename goworld.go to main.go
package main
import (
"flag"
"fmt"
"os"
"runtime"
"strings"
)
var arguments struct {
runInDaemonMode bool
}
func parseArgs() {
//flag.StringVar(&arguments.configFile, "configfile", "", "set config file path")
flag.BoolVar(&arguments.runInDaemonMode, "d", false, "run in daemon mode")
flag.Parse()
}
func main() {
parseArgs()
args := flag.Args()
showMsg("arguments: %s", strings.Join(args, " "))
detectGoWorldPath()
if len(args) == 0 {
showMsg("no command to execute")
flag.Usage()
fmt.Fprintf(os.Stderr, "\tgoworld <build|start|stop|kill|reload|status> [server-id]\n")
os.Exit(1)
}
cmd := args[0]
if cmd == "build" || cmd == "start" || cmd == "stop" || cmd == "reload" || cmd == "kill" {
if len(args) != 2 {
showMsgAndQuit("server id is not given")
}
}
if cmd == "build" {
build(ServerID(args[1]))
} else if cmd == "start" {
start(ServerID(args[1]))
} else if cmd == "stop" {
if runtime.GOOS == "windows" {
showMsgAndQuit("stop does not work on Windows, use kill instead (will lose player data)")
}
stop(ServerID(args[1]))
} else if cmd == "reload" {
reload(ServerID(args[1]))
} else if cmd == "kill" {
kill(ServerID(args[1]))
} else if cmd == "status" {
status()
} else {
showMsgAndQuit("unknown command: %s", cmd)
}
}
1
https://gitee.com/mirrors/goworld.git
git@gitee.com:mirrors/goworld.git
mirrors
goworld
goworld
v0.1.6

搜索帮助