def file_collision(destination)
return true if @always_force
options = block_given? ? "[Ynaqdhm]" : "[Ynaqh]"
loop do
answer = ask(
%[Overwrite #{destination}? (enter "h" for help) #{options}],
:add_to_history => false
)
case answer
when nil
say ""
return true
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..."
raise SystemExit
when is?(:diff)
show_diff(destination, yield) if block_given?
say "Retrying..."
when is?(:merge)
if block_given? && !merge_tool.empty?
merge(destination, yield)
return nil
end
say "Please specify merge tool to `THOR_MERGE` env."
else
say file_collision_help
end
end
end