def confirm_command(app = app)
if extract_option('--force')
display("Warning: The --force switch is deprecated, and will be removed in a future release. Use --confirm #{app} instead.")
return true
end
raise(Heroku::Command::CommandFailed, "No app specified.\nRun this command from app folder or set it adding --app <app name>") unless app
confirmed_app = extract_option('--confirm', false)
if confirmed_app
unless confirmed_app == app
raise(Heroku::Command::CommandFailed, "Confirmed app #{confirmed_app} did not match the selected app #{app}.")
end
return true
else
display ""
display " ! WARNING: Potentially Destructive Action"
display " ! This command will affect the app: #{app}"
display " ! To proceed, type \"#{app}\" or re-run this command with --confirm #{app}"
display ""
display "> ", false
if ask.downcase != app
display " ! Input did not match #{app}. Aborted."
false
else
true
end
end
end