func (o *deleteJobOpts) Ask() error {
	if err := o.askAppName(); err != nil {
		return err
	}
	if err := o.askJobName(); err != nil {
		return err
	}

	if o.skipConfirmation {
		return nil
	}

	// When there's no env name passed in, we'll completely
	// remove the job from the application.
	deletePrompt := fmt.Sprintf(fmtJobDeleteConfirmPrompt, o.name, o.appName)
	deleteConfirmHelp := jobDeleteConfirmHelp
	if o.envName != "" {
		// When a customer provides a particular environment,
		// we'll just delete the job from that environment -
		// but keep it in the app.
		deletePrompt = fmt.Sprintf(fmtJobDeleteFromEnvConfirmPrompt, o.name, o.envName)
		deleteConfirmHelp = fmt.Sprintf(jobDeleteFromEnvConfirmHelp, o.envName)
	}

	deleteConfirmed, err := o.prompt.Confirm(
		deletePrompt,
		deleteConfirmHelp)

	if err != nil {
		return fmt.Errorf("job delete confirmation prompt: %w", err)
	}
	if !deleteConfirmed {
		return errJobDeleteCancelled
	}
	return nil
}
// Ask prompts the user for any required flags.
Ask prompts the user for any required flags.
// Ask prompts the user for any required flags .
func (o *deleteJobOpts) Ask() error {
	if err := o.askAppName(); err != nil {
		return err
	}
	if err := o.askJobName(); err != nil {
		return err
	}
	if o.skipConfirmation {
		return nil
	}
	deletePrompt := fmt.Sprintf(fmtJobDeleteConfirmPrompt, o.name, o.appName)
	deleteConfirmHelp := jobDeleteConfirmHelp
	if o.envName != "" {
		deletePrompt = fmt.Sprintf(fmtJobDeleteFromEnvConfirmPrompt, o.name, o.envName)
		deleteConfirmHelp = fmt.Sprintf(jobDeleteFromEnvConfirmHelp, o.envName)
	}
	deleteConfirmed, err := o.prompt.Confirm(
		deletePrompt,
		deleteConfirmHelp)
	if err != nil {
		return fmt.Errorf("job delete confirmation prompt: %w", err)
	}
	if !deleteConfirmed {
		return errJobDeleteCancelled
	}
	return nil
}
func ( o * deleteJobOpts ) Ask ( ) error { if err := o . askAppName ( ) ; err != nil { return err } if err := o . askJobName ( ) ; err != nil { return err } if o . skipConfirmation { return nil } deletePrompt := fmt . Sprintf ( fmtJobDeleteConfirmPrompt , o . name , o . appName ) deleteConfirmHelp := jobDeleteConfirmHelp if o . envName != " " { deletePrompt = fmt . Sprintf ( fmtJobDeleteFromEnvConfirmPrompt , o . name , o . envName ) deleteConfirmHelp = fmt . Sprintf ( jobDeleteFromEnvConfirmHelp , o . envName ) } deleteConfirmed , err := o . prompt . Confirm ( deletePrompt , deleteConfirmHelp ) if err != nil { return fmt . Errorf ( " " , err ) } if ! deleteConfirmed { return errJobDeleteCancelled } return nil }
Ask prompts the user for any required flags.
Ask prompts the user for any required flags .
// When there's no env name passed in, we'll completely // remove the job from the application. // When a customer provides a particular environment, // we'll just delete the job from that environment - // but keep it in the app.