<commit_before>require 'pathname'
lib_dir = Pathname(__FILE__).expand_path.dirname.to_s
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)

require 'launchy'
require 'commands/commands'

module RunCodeRun
  extend self
  def activate(args)
    if args.empty? || args.nil?
      invoke("help")
    else
      invoke(args.shift, *args)
    end
  end
  
  def all_commands
    Commands.public_instance_methods(true).sort
  end
  
  def invoke(command, *args)
    command = command.intern
    debug "Invoking command: #{command}, args: #{args.inspect}"
    if all_commands.include?(command)
      Commands.send(command, *args)
    else
      ui.puts %[The command '#{command}' does not exist; currently supported commands are '#{all_commands.join(", ")}']
      abort<commit_msg>...and 186 compat as well<commit_after>require 'pathname'
lib_dir = Pathname(__FILE__).expand_path.dirname.to_s
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)

require 'launchy'
require 'commands/commands'

module RunCodeRun
  extend self
  def activate(args)
    if args.empty? || args.nil?
      invoke("help")
    else
      invoke(args.shift, *args)
    end
  end
  
  def all_commands
    Commands.public_instance_methods(true).sort.map {|m| m.intern }
  end
  
  def invoke(command, *args)
    command = command.intern
    debug "Invoking command: #{command}, args: #{args.inspect}"
    if all_commands.include?(command)
      Commands.send(command, *args)
    else
      ui.puts %[The command '#{command}' does not exist; currently supported commands are '#{all_commands.join(", ")}']
      abort
{'fraction_non_alphanumeric': 0.12251243781094527, 'fraction_numerical': 0.0018656716417910447, 'mean_word_length': 3.8029850746268656, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1500330', 'n_tokens_mistral': 525, 'n_tokens_neox': 527, 'n_words': 123}