// AppDestroy destroys an app. func AppDestroy(appID, confirm string) error { gitSession := false c, err := client.New() if err != nil { return err } if appID == "" { appID, err = git.DetectAppName(c.ControllerURL.Host) if err != nil { return err } gitSession = true } if confirm == "" { fmt.Printf(` ! WARNING: Potentially Destructive Action ! This command will destroy the application: %s ! To proceed, type "%s" or re-run this command with --confirm=%s > `, appID, appID, appID) fmt.Scanln(&confirm) } if confirm != appID { return fmt.Errorf("App %s does not match confirm %s, aborting.", appID, confirm) } startTime := time.Now() fmt.Printf("Destroying %s...\n", appID) if err = apps.Delete(c, appID); err != nil { return err } fmt.Printf("done in %ds\n", int(time.Since(startTime).Seconds())) if gitSession { return git.DeleteRemote(appID) } return nil }
func load(appID string) (*client.Client, string, error) { c, err := client.New() if err != nil { return nil, "", err } if appID == "" { appID, err = git.DetectAppName(c.ControllerURL.Host) if err != nil { return nil, "", err } } return c, appID, nil }
func permsLoad(appID string, admin bool) (*client.Client, string, error) { c, err := client.New() if err != nil { return nil, "", err } if !admin && appID == "" { appID, err = git.DetectAppName(c.ControllerURL.Host) if err != nil { return nil, "", err } } return c, appID, err }