<commit_before>require "multirepo/utility/console"
require "multirepo/files/config-file"

module MultiRepo
  class Add < Command
    self.command = "add"
    self.summary = "Add a dependency repository to the .multirepo file."
    
    def initialize(argv)
      @path = argv.shift_argument
      super
    end
    
    def validate!
      super
      help! "You must provide a repo path to add as a dependency" unless @path
    end
    
    def run
      super
      ensure_multirepo_initialized
      ensure_repo_exists
      
      entry = ConfigEntry.new(Repo.new(@path))
      if ConfigFile.entry_exists?(entry)
        Console.log_info("There is already an entry for #{@path} in the .multirepo file")
      else
        ConfigFile.add_entry(entry)
        ConfigFile.stage
        Console.log_substep("Added #{@path} to the .multirepo file")
      end
    rescue MultiRepoException => e
      Console.log_error(e.message)
    end
    
    def ensure_repo_exists
      raise MultiRepoException, "There is no folder at path #{@path}" unless Dir.exists?(@path)
      raise MultiRepoException, "#{@path} is not a repository" unless Repo.new(@path).exists?
    end
  end
end<commit_msg>Changed log level of add command success message.<commit_after>require "multirepo/utility/console"
require "multirepo/files/config-file"

module MultiRepo
  class Add < Command
    self.command = "add"
    self.summary = "Add a dependency repository to the .multirepo file."
    
    def initialize(argv)
      @path = argv.shift_argument
      super
    end
    
    def validate!
      super
      help! "You must provide a repo path to add as a dependency" unless @path
    end
    
    def run
      super
      ensure_multirepo_initialized
      ensure_repo_exists
      
      entry = ConfigEntry.new(Repo.new(@path))
      if ConfigFile.entry_exists?(entry)
        Console.log_info("There is already an entry for #{@path} in the .multirepo file")
      else
        ConfigFile.add_entry(entry)
        ConfigFile.stage
        Console.log_step("Added #{@path} to the .multirepo file")
      end
    rescue MultiRepoException => e
      Console.log_error(e.message)
    end
    
    def ensure_repo_exists
      raise MultiRepoException, "There is no folder at path #{@path}" unless Dir.exists?(@path)
      raise MultiRepoException, "#{@path} is not a repository" unless Repo.new(@path).exists?
    end
  end
end
{'fraction_non_alphanumeric': 0.08350643955130868, 'fraction_numerical': 0.0, 'mean_word_length': 2.65402124430956, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '493658', 'n_tokens_mistral': 703, 'n_tokens_neox': 718, 'n_words': 214}