<commit_before>module Ufo
  class Destroy < Base
    def bye
      unless are_you_sure?
        puts "Phew, that was close"
        return
      end

      stack = find_stack(@stack_name)
      unless stack
        puts "Stack #{@stack_name.color(:green)} does not exist."
        exit
      end

      if stack.stack_status =~ /_IN_PROGRESS$/
        puts "Cannot destroy service #{@service.color(:green)}"
        puts "Cannot delete stack #{@stack_name.color(:green)} in this state: #{stack.stack_status.color(:green)}"
        puts "If the stack is taking a long time, you can cancel the current operation with:"
        puts "  ufo cancel #{@service}"
        return
      end

      cloudformation.delete_stack(stack_name: @stack_name)
      puts "Deleting CloudFormation stack with ECS resources: #{@stack_name}."

      return unless @options[:wait]
      start_time = Time.now
      status.wait
      took = Time.now - start_time
      puts "Time took for deletion: #{status.pretty_time(took).color(:green)}."
    end

    def are_you_sure?
      return true if @options[:sure]
      puts "You are about to destroy #{@service.color(:green)} service on the #{@cluster.color(:green)} cluster."
      print "Are you sure you want to do this? (y/n) "
      answer = $stdin.gets.strip
      answer =~ /^y/
    end
  end
end
<commit_msg>improve ufo destroy confirm message<commit_after>module Ufo
  class Destroy < Base
    def bye
      unless are_you_sure?
        puts "Phew, that was close"
        return
      end

      stack = find_stack(@stack_name)
      unless stack
        puts "Stack #{@stack_name.color(:green)} does not exist."
        exit
      end

      if stack.stack_status =~ /_IN_PROGRESS$/
        puts "Cannot destroy service #{@service.color(:green)}"
        puts "Cannot delete stack #{@stack_name.color(:green)} in this state: #{stack.stack_status.color(:green)}"
        puts "If the stack is taking a long time, you can cancel the current operation with:"
        puts "  ufo cancel #{@service}"
        return
      end

      cloudformation.delete_stack(stack_name: @stack_name)
      puts "Deleting CloudFormation stack with ECS resources: #{@stack_name}."

      return unless @options[:wait]
      start_time = Time.now
      status.wait
      took = Time.now - start_time
      puts "Time took for deletion: #{status.pretty_time(took).color(:green)}."
    end

    def are_you_sure?
      return true if @options[:sure]
      puts "You are about to destroy the #{@stack_name.color(:green)} stack. This contains the #{@service.color(:green)} service on the #{@cluster.color(:green)} cluster."
      print "Are you sure you want to do this? (y/N) "
      answer = $stdin.gets.strip
      answer =~ /^y/
    end
  end
end

{'fraction_non_alphanumeric': 0.10760869565217392, 'fraction_numerical': 0.0, 'mean_word_length': 2.6091503267973857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6915438', 'n_tokens_mistral': 830, 'n_tokens_neox': 825, 'n_words': 270}