Exemplo n.º 1
0
func FlagRemoteAutoComplete(c *cli.Context) bool {
	if dir, ok := appdetect.DetectGit(); ok {
		remoteNames := appdetect.ScalingoRepoComplete(dir)
		for _, name := range remoteNames {
			fmt.Println(name)
		}
	} else {
		return false
	}
	return true
}
Exemplo n.º 2
0
func Create(appName string, remote string) error {
	app, err := api.AppsCreate(appName)
	if err != nil {
		return errgo.Mask(err, errgo.Any)
	}

	fmt.Printf("App '%s' has been created\n", app.Name)
	if _, ok := appdetect.DetectGit(); ok && appdetect.AddRemote(app.GitUrl, remote) == nil {
		fmt.Printf("Git repository detected: remote %s added\n→ 'git push %s master' to deploy your app\n", remote, remote)
	} else {
		fmt.Printf("To deploy your application, run these commands in your GIT repository:\n→ git remote add %s %s\n→ git push %s master\n", remote, app.GitUrl, remote)
	}
	return nil
}
Exemplo n.º 3
0
func CurrentAppCompletion(c *cli.Context) string {
	appName := ""
	if len(os.Args) >= 2 {
		for i := range os.Args {
			if i < len(os.Args) && (os.Args[i] == "-a" || os.Args[i] == "--app") {
				if (i+1) < len(os.Args) && os.Args[i+1] != "" {
					return os.Args[i+1]
				}
			}
		}
	}
	if appName == "" && os.Getenv("SCALINGO_APP") != "" {
		appName = os.Getenv("SCALINGO_APP")
	}
	if dir, ok := appdetect.DetectGit(); appName == "" && ok {
		appName, _ = appdetect.ScalingoRepo(dir, c.GlobalString("remote"))
	}
	return appName
}