<commit_before>$LOAD_PATH.unshift("#{HOMEBREW_REPOSITORY}/Library/Homebrew/cask/lib")

require "hbc"

CASKROOM = Hbc.caskroom

module Hbc
  def self.outdated(options)
    outdated = []
    installed_count = Hbc.installed.length
    zero_pad = installed_count.to_s.length
    suppress_errors = !options.cask.nil? || false

    each_installed(suppress_errors) do |app, i|
      counter = "(%0#{zero_pad}d/%d)"

      if options.cask
        next unless options.cask[:name] == app[:name]
        string_template = "#{app[:name]}: "
      else
        string_template = "#{counter} #{app[:name]}: "
      end


      print format(string_template, i + 1, installed_count)
        puts "#{Tty.red}latest but forced to upgrade#{Tty.reset}"
      if options.all && app[:latest] == "latest"
        outdated.push app
      elsif app[:installed].include? app[:latest]
        puts "#{Tty.green}up to date#{Tty.reset}"
      else
        puts "#{Tty.red}#{app[:installed].join(", ")}#{Tty.reset} -> #{Tty.green}#{app[:latest]}#{Tty.reset}"
        outdated.push app
      end
    end
    outdated
  end

  def self.each_installed(suppress_errors = false)
    Hbc.installed.each_with_index do |name, i|
      begin
        cask = Hbc.load name.to_s
        yield({
          :cask => cask,
          :name => name.to_s,
          :latest => cask.version.to_s,
          :installed => installed_versions(name),
        }, i)
      rescue Hbc::CaskError => e
        puts e unless suppress_errors
      end
    end
  end<commit_msg>Added a "full name" attribute to yielded cask object for nicer display.<commit_after>$LOAD_PATH.unshift("#{HOMEBREW_REPOSITORY}/Library/Homebrew/cask/lib")

require "hbc"

CASKROOM = Hbc.caskroom

module Hbc
  def self.outdated(options)
    outdated = []
    installed_count = Hbc.installed.length
    zero_pad = installed_count.to_s.length
    suppress_errors = !options.cask.nil? || false

    each_installed(suppress_errors) do |app, i|
      counter = "(%0#{zero_pad}d/%d)"
      string_template = "#{app[:full_name]} (#{app[:name]}): "

      if options.cask
        next unless options.cask[:name] == app[:name]
      else
        string_template = "#{counter} #{string_template}"
      end


      print format(string_template, i + 1, installed_count)
        puts "#{Tty.red}latest but forced to upgrade#{Tty.reset}"
      if options.all && app[:latest] == "latest"
        outdated.push app
      elsif app[:installed].include? app[:latest]
        puts "#{Tty.green}up to date#{Tty.reset}"
      else
        puts "#{Tty.red}#{app[:installed].join(", ")}#{Tty.reset} -> #{Tty.green}#{app[:latest]}#{Tty.reset}"
        outdated.push app
      end
    end
    outdated
  end

  def self.each_installed(suppress_errors = false)
    Hbc.installed.each_with_index do |name, i|
      begin
        cask = Hbc.load name.to_s
        yield({
          :cask => cask,
          :name => name.to_s,
          :full_name => cask.name.first,
          :latest => cask.version.to_s,
          :installed => installed_versions(name),
        }, i)
      rescue Hbc::CaskError => e
        puts e unless suppress_errors
      end
    end
  end
{'fraction_non_alphanumeric': 0.13905606588533417, 'fraction_numerical': 0.0012670256572695597, 'mean_word_length': 2.6132723112128144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '3346222', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1070, 'n_words': 217}