<commit_before>module Goku
  class CLI < Thor

    desc "c PATH", "Create a class"
    def c(raw_path)
      path = Goku::Path.new(raw_path)

      modules = path.directories.drop(1).map do |module_name|
        Goku::Factories::Module.new(module_name)
      end

      klass = Goku::Factories::Class.new(path.filename)
      klass.add(Goku::Factories::Method.new("initialize"))

      modules.last.add(klass)

      modules.reverse.each_cons(2) do |submodule, parent_module|
        parent_module.add(submodule)
      end

      puts modules.first.to_s
    end

    desc "m PATH", "Create a module"
    def m(raw_path)
      path = Goku::Path.new(raw_path)

      mod = Goku::Factories::Module.new(path.filename)

      puts mod
    end

    map "module" => "m"
    map "class" => "m"
  end
end<commit_msg>Create nested modules<commit_after>module Goku
  class CLI < Thor

    desc "c PATH", "Create a class"
    def c(raw_path)
      path = Goku::Path.new(raw_path)

      modules = create_modules(path)

      klass = Goku::Factories::Class.new(path.filename)

      klass.add(Goku::Factories::Method.new("initialize"))

      modules.last.add(klass)

      puts modules.first.to_s
    end

    desc "m PATH", "Create a module"
    def m(raw_path)
      path = Goku::Path.new(raw_path)

      modules = create_modules(path)

      mod = Goku::Factories::Module.new(path.filename)

      modules.last.add(mod)

      puts modules.first.to_s
    end

    map "module" => "m"
    map "class" => "m"

    private

    def create_modules(path)
      modules = path.directories.drop(1).map { |m| Goku::Factories::Module.new(m) }

      modules.reverse.each_cons(2) do |submodule, parent_module|
        parent_module.add(submodule)
      end

      modules
    end
  end
end
{'fraction_non_alphanumeric': 0.12535290796160362, 'fraction_numerical': 0.002258610954263128, 'mean_word_length': 2.683991683991684, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5125867', 'n_tokens_mistral': 625, 'n_tokens_neox': 602, 'n_words': 123}