// DetectAppName detects if there is deis remote in git.
429891
func DetectAppName(host string) (string, error) {
	remote, err := findRemote(host)

	// Don't return an error if remote can't be found, return directory name instead.
	if err != nil {
		dir, err := os.Getwd()
		return strings.ToLower(path.Base(dir)), err
	}

	ss := strings.Split(remote, "/")
	return strings.Split(ss[len(ss)-1], ".")[0], nil
}
1065057
func appRBACName(app appv1.Application) string {
	return fmt.Sprintf("%s/%s", app.Spec.GetProject(), app.Name)
}
583207
func getAppName(p *pkgPod.Pod) (*types.ACName, error) {
	if flagAppName != "" {
		return types.NewACName(flagAppName)
	}

	// figure out the app name, or show a list if multiple are present
	_, m, err := p.PodManifest()
	if err != nil {
		return nil, errwrap.Wrap(errors.New("error reading pod manifest"), err)
	}

	switch len(m.Apps) {
	case 0:
		return nil, fmt.Errorf("pod contains zero apps")
	case 1:
		return &m.Apps[0].Name, nil
	default:
	}

	stderr.Print("pod contains multiple apps:")
	for _, ra := range m.Apps {
		stderr.Printf("\t%v", ra.Name)
	}

	return nil, fmt.Errorf("specify app using \"rkt enter --app= ...\"")
}
331902
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
}
359454
func (s *ApplicationDescription) SetApplicationName(v string) *ApplicationDescription {
	s.ApplicationName = &v
	return s
}
317904
func (s *DescribeApplicationVersionsInput) SetApplicationName(v string) *DescribeApplicationVersionsInput {
	s.ApplicationName = &v
	return s
}
960444
func (s *BatchGetApplicationRevisionsInput) SetApplicationName(v string) *BatchGetApplicationRevisionsInput {
	s.ApplicationName = &v
	return s
}
887974
func (s *CreateDeploymentInput) SetApplicationName(v string) *CreateDeploymentInput {
	s.ApplicationName = &v
	return s
}
1071395
func (s *EventDescription) SetApplicationName(v string) *EventDescription {
	s.ApplicationName = &v
	return s
}
163290
func (s *DescribeConfigurationOptionsInput) SetApplicationName(v string) *DescribeConfigurationOptionsInput {
	s.ApplicationName = &v
	return s
}
1124830
func (u *Unit) ApplicationName() string {
	application, err := names.UnitApplication(u.Name())
	if err != nil {
		panic(err)
	}
	return application
}
46650
func (s *AddApplicationInputProcessingConfigurationInput) SetApplicationName(v string) *AddApplicationInputProcessingConfigurationInput {
	s.ApplicationName = &v
	return s
}
410020
func (s *ListDeploymentGroupsInput) SetApplicationName(v string) *ListDeploymentGroupsInput {
	s.ApplicationName = &v
	return s
}
256884
func (s *CreateApplicationSnapshotInput) SetApplicationName(v string) *CreateApplicationSnapshotInput {
	s.ApplicationName = &v
	return s
}
1367481
func (s *Event) SetAppPackageName(v string) *Event {
	s.AppPackageName = &v
	return s
}
380253
func (s *DeleteApplicationVersionInput) SetApplicationName(v string) *DeleteApplicationVersionInput {
	s.ApplicationName = &v
	return s
}
211869
func OptAppName(n string) func(*App) {
	return func(app *App) {
		assertAppNotNill(app)
		app.name = n
	}
}