Example #1
0
func Server(c *cli.Context) string {
	val := c.String("server")
	if val == "" {
		val = c.GlobalString("server")
	}
	return val
}
Example #2
0
// If user specifies the app's name from command line, then use it;
// otherwise use the current working directory's name
// from https://github.com/convox/cli/blob/0c3efc6892cb9a58aec60bd912e060c602f9ab61/stdcli/stdcli.go#L86
func DirApp(c *cli.Context, wd string) (string, string, error) {
	abs, err := filepath.Abs(wd)

	if err != nil {
		return "", "", err
	}

	app := c.String("app")
	if app == "" {
		app = c.GlobalString("app")
	}

	if app == "" {
		app = path.Base(abs)
	}

	return abs, app, nil
}