class Bundler::Thor::Shell::Basic

def file_collision(destination) # rubocop:disable MethodLength

rubocop:disable MethodLength

block:: an optional block that returns the value to be used in diff
destination:: the destination file to solve conflicts
==== Parameters

response as the content for the diff.
overwritten and false otherwise. If a block is given, it uses the block
Deals with file collision and returns true if the file should be
def file_collision(destination) # rubocop:disable MethodLength
  return true if @always_force
  options = block_given? ? "[Ynaqdh]" : "[Ynaqh]"
  loop do
    answer = ask(
      %[Overwrite #{destination}? (enter "h" for help) #{options}],
      :add_to_history => false
    )
    case answer
    when is?(:yes), is?(:force), ""
      return true
    when is?(:no), is?(:skip)
      return false
    when is?(:always)
      return @always_force = true
    when is?(:quit)
      say "Aborting..."
      fail SystemExit
    when is?(:diff)
      show_diff(destination, yield) if block_given?
      say "Retrying..."
    else
      say file_collision_help
    end
  end
end