Exemplo n.º 1
0
Arquivo: ng.go Projeto: mjason/ng
func main() {
	if len(os.Args) == 1 {
		fmt.Println("输入的命令无效\n install: 安装依赖库 \n dev: 设置GOPATH和gocode \n init: 创建一个项目")
	} else if os.Args[1] == "init" {
		create.CreateProject()
	} else if os.Args[1] == "install" {
		install.Install()
	} else if os.Args[1] == "dev" {
		dev.Gopath()
	} else {
		fmt.Println("输入的命令无效\n install: 安装依赖库 \n dev: 设置GOPATH和gocode \n init: 创建一个项目")
	}
}
Exemplo n.º 2
0
Arquivo: create.go Projeto: mjason/ng
func CreateProject() {
	dirLists := [5]string{"src", "bin", "pkg", "doc", "script"}
	fileLists := [2]string{"project.json", "README.md"}

	for _, v := range dirLists {
		err := os.Mkdir(v, 0777)
		if err != nil {
			panic(err)
		}
		fmt.Printf("创建 %s, ......... ok !!!! \n", v)
	}

	for _, v := range fileLists {
		err := createFile(v)
		if err != nil {
			panic(err)
		}
		fmt.Printf("创建 %s, ......... ok !!!! \n", v)
	}

	dev.Gopath()

}