<commit_before>require 'commands/base'

module Commands
  class Cleanup < Base

    def run!
      super


      return 0
    end

  end
end
<commit_msg>Adds the Cleanup command<commit_after>require 'commands/base'

module Commands
  class Cleanup < Base

    def run!
      super

      get('git branch -vv').split("\n").each do |raw|
        parts = parse_line(raw)

        sys("git branch -d #{parts[1]}") if parts && parts[3].include?(': gone')
      end

      return 0
    end

    protected

    def parse_line(line)
      /\A(.*?)\s+([\w\d]{7})\s\[(.*?)\]\s(.*)\z/.match(line.strip)
    end

  end
end

{'fraction_non_alphanumeric': 0.15384615384615385, 'fraction_numerical': 0.008183306055646482, 'mean_word_length': 2.221052631578947, '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': '885960', 'n_tokens_mistral': 225, 'n_tokens_neox': 208, 'n_words': 54}