<commit_before>class Pry
  module DefaultCommands

    Input = Pry::CommandSet.new :input do

      command "!", "Clear the input buffer. Useful if the parsing process goes wrong and you get stuck in the read loop." do
        output.puts "Input buffer cleared!"
        opts[:eval_string].clear
      end

      command "hist", "Show and replay Readline history. Type `hist --help` for more info." do |*args|
        history = Readline::HISTORY.to_a

        if args.empty?
          text = add_line_numbers history.join("\n"), 0
          stagger_output text
          next
        end

        Slop.parse(args) do |opt|
          opt.banner "Usage: hist [--replay START..END]\n" \
                     "View and replay history\n" \
                     "e.g hist --replay 2..8"

          opt.on :r, :replay, 'The line (or range of lines) to replay.', true, :as => Range do |range|
            actions = history[range].join("\n") + "\n"
            Pry.active_instance.input = StringIO.new(actions)
          end

          opt.on :h, :help, 'Show this message.', :tail => true do
            output.puts opt.help
          end
        end
      end
<commit_msg>Use #on_empty.<commit_after>class Pry
  module DefaultCommands

    Input = Pry::CommandSet.new :input do

      command "!", "Clear the input buffer. Useful if the parsing process goes wrong and you get stuck in the read loop." do
        output.puts "Input buffer cleared!"
        opts[:eval_string].clear
      end

      command "hist", "Show and replay Readline history. Type `hist --help` for more info." do |*args|
        history = Readline::HISTORY.to_a

        Slop.parse(args) do |opt|
          opt.banner "Usage: hist [--replay START..END]\n" \
                     "View and replay history\n" \
                     "e.g hist --replay 2..8"

          opt.on :r, :replay, 'The line (or range of lines) to replay.', true, :as => Range do |range|
            actions = history[range].join("\n") + "\n"
            Pry.active_instance.input = StringIO.new(actions)
          end

          opt.on :h, :help, 'Show this message.', :tail => true do
            output.puts opt.help
          end

          opt.on_empty do
            text = add_line_numbers history.join("\n"), 0
            stagger_output text
          end
        end
      end

{'fraction_non_alphanumeric': 0.11225806451612903, 'fraction_numerical': 0.0025806451612903226, 'mean_word_length': 1.7956730769230769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1059263', 'n_tokens_mistral': 699, 'n_tokens_neox': 668, 'n_words': 228}