Example #1
0
File: local.go Project: ryo33/zenv
func doLocal(c *cli.Context) {
	pwd := util.GetCurrentPath()
	if environment.ExistsLocalEnv(pwd) && !c.Bool("force") {
		util.PrintErrorMessage(fmt.Sprintf("%s already exists\n--force flag to force to initialize", environment.ZENV_LOCAL))
	} else {
		env := environment.NewEnv(false, pwd, !c.Bool("not-recursive"), c.Bool("exclusive"))
		env.Write()
	}
}
Example #2
0
File: global.go Project: ryo33/zenv
func doGlobal(c *cli.Context) {
	args := c.Args()
	if len(args) == 0 {
		for _, arg := range environment.GetGlovalEnvs() {
			util.Print(arg)
		}
	} else if c.Bool("remove") {
		for _, arg := range args {
			environment.RemoveGlobalEnv(arg)
		}
	} else {
		for _, arg := range args {
			//create new global environment
			env := environment.NewEnv(true, arg, c.Bool("recursive"), c.Bool("exclusive"))
			env.Write()
			env.AddGlobalEnv(c.Bool("force"))
		}
	}
}