class LicenseAcceptance::Strategy::Prompt

def ask(output, c, s, persist_callback)

def ask(output, c, s, persist_callback)
  logger.debug("Attempting to request interactive prompt on TTY")
  prompt = TTY::Prompt.new(track_history: false, active_color: :bold, interrupt: :exit, output: output)
  answer = "no"
  begin
    Timeout::timeout(60, PromptTimeout) do
      answer = prompt.ask(">") do |q|
        q.modify :down, :trim
        q.required true
        q.messages[:required?] = "You must enter 'yes' or 'no'"
        q.validate /^\s*(yes|no)\s*$/i
        q.messages[:valid?] = "You must enter 'yes' or 'no'"
      end
    end
  rescue PromptTimeout
    prompt.unsubscribe(prompt.reader)
    output.puts "Prompt timed out. Use non-interactive flags or enter an answer within 60 seconds."
  end
  if answer == "yes"
    output.puts
    output.puts "Persisting #{c} product license#{s}..."
    errs = persist_callback.call
    if errs.empty?
      output.puts "#{CHECK} #{c} product license#{s} persisted.\n\n"
    else
      output.puts <<~EOM
      #{CHECK} #{c} product license#{s} accepted.
      Could not persist acceptance:\n\t* #{errs.map(&:message).join("\n\t* ")}
      EOM
    end
    return true
  end
  return false
end