<commit_before>require 'core/command'
require 'core/cli_interface'

class Commander

  def initialize
    @commands = Command.load_all
    @cli_interface = CliInterface.new
  end

  def go
    if ARGV.size == 0
      ARGV.push Command.default_cmd # default action
    end

    if ARGV.first == '--version'
      ARGV[0] = 'version' # simulate 'script --version' functionality
    end

    if ARGV.first == '-h' || ARGV.first == '--help'
      ARGV[0] = 'help' # catch help requests.
    end

    if ARGV.first[0,1] !~ /^[a-zA-z]$/ 
      puts "ERROR: Please specify a command as first argument"
      exit
    end

    command = ARGV.shift # first parameter should be the command at this point.

    unless @commands.keys.include?(command)
      puts "ERROR: Invalid command: "  + command + ". Please use 'help' command for a list of allowed commands."
      exit<commit_msg>removed @cli_interface variable and refactored argument parsing to allow for 'single' mode.<commit_after>require 'core/command'

class Commander

  def initialize
    @commands = Command.load_all
  end

  def go
    if ARGV.first == '--version'
      ARGV[0] = 'version' # simulate 'script --version' functionality
    end

    if ARGV.first == '-h' || ARGV.first == '--help'
      ARGV[0] = 'help' # catch help requests.
    end

    if Rcli.script_config['global']['mode'] == 'multi' && ARGV.size == 0 
      ARGV.push Command.default_cmd # default action
    end
    

    if Rcli.script_config['global']['mode'] == 'single'
      if ARGV[0] != 'help' && ARGV[0] != 'version' && ARGV[0] != 'debug'
        ARGV.insert( 0, Command.default_cmd)
      end
    elsif ARGV.first[0,1] !~ /^[a-zA-z]$/ 
      puts "ERROR: Please specify a command as first argument"
      exit
    end

    command = ARGV.shift # first parameter should be the command at this point.

    unless @commands.keys.include?(command)
      puts "ERROR: Invalid command: "  + command + ". Please use 'help' command for a list of allowed commands."
      exit
{'fraction_non_alphanumeric': 0.12518703241895263, 'fraction_numerical': 0.006982543640897756, 'mean_word_length': 2.714814814814815, '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': '5409564', 'n_tokens_mistral': 664, 'n_tokens_neox': 620, 'n_words': 196}