<commit_before>require 'hoister/cli/errors'
require 'hoister/cli/parsers'

module Hoister
  class Cli

    # Describes a command and helps executing it
    # 
    # The command is defined by a name and a list of arguments (see class Param).
    # The body of the command is a lambda that accepts exactly the arguments

    class Command
      include Parsers::BasicParsers

      # The name of the command
      attr_reader :name

      # The list of arguments
      attr_reader :params

      # The command's body
      attr_reader :body

      # An optional short desicription of the command
      attr_reader :desc

      # Initializes a new command
      def initialize(name, params = [], body, desc: "")
        @name   = name.to_sym
        @params = params
        @body   = body

        @desc   = desc
      end

      # runs the command 
      def dispatch(*args)
        @body.call(*args)
      rescue ArgumentError => e
        raise CommandArgumentError.new(name), e.message
      end
<commit_msg>arguments -> parameters<commit_after>require 'hoister/cli/errors'
require 'hoister/cli/parsers'

module Hoister
  class Cli

    # Describes a command and helps executing it
    # 
    # The command is defined by a name and a list of arguments (see class Param).
    # The body of the command is a lambda that accepts exactly the arguments

    class Command
      include Parsers::BasicParsers

      # The name of the command
      attr_reader :name

      # The list of parameters
      attr_reader :params

      # The command's body
      attr_reader :body

      # An optional short desicription of the command
      attr_reader :desc

      # Initializes a new command
      def initialize(name, params = [], body, desc: "")
        @name   = name.to_sym
        @params = params
        @body   = body

        @desc   = desc
      end

      # runs the command 
      def dispatch(*args)
        @body.call(*args)
      rescue ArgumentError => e
        raise CommandArgumentError.new(name), e.message
      end

{'fraction_non_alphanumeric': 0.06597735105859183, 'fraction_numerical': 0.0, 'mean_word_length': 2.1949685534591197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6581976', 'n_tokens_mistral': 567, 'n_tokens_neox': 542, 'n_words': 211}