class Envirobly::Cli::Main

def deploy(environ_name = nil)

def deploy(environ_name = nil)
  commit = Envirobly::Git::Commit.new options.commit
  unless commit.exists?
    say_error "Commit '#{commit.ref}' doesn't exist in this repository. Aborting."
    exit 1
  end
  Envirobly::AccessToken.new(shell:).require!
  environ_name = environ_name.presence || commit.current_branch
  project_name = nil
  project_id = nil
  if options.project.present?
    if options.project =~ Envirobly::Defaults::Project.regexp
      project_id = $1.to_i
    else
      project_name = options.project
    end
  end
  deployment = Envirobly::Deployment.new(
    account_id: options.account_id,
    region: options.region,
    project_name:,
    environ_name:,
    project_id:,
    commit:,
    shell:
  )
  deployment.perform(dry_run: options.dry_run)
end