<commit_before>module Xploy
  class Cli
    def initialize api, out, template_class
      @api = api
      @out = out
      @template_class = template_class
    end

    def start
      parameter = Xploy.parameter
      commands = parameter.rest
      if parameter[:version]
        @out.puts "xploy #{VERSION}"
      elsif commands.empty?
        parameter.print_help!
      elsif commands.first == 'new'
        template_data = @template_class.new.to_s
        if path = commands[1]
          File.open(path, 'w') { |f| f.write template_data }
        else
          @out.puts template_data
        end
      else
        @out.puts @api.request(*commands)
      end
    rescue MissingParameter => e
      @out.puts e.message
    end
  end
end<commit_msg>Cleanup Cli#start method<commit_after>module Xploy
  class Cli
    def initialize api, out, template_class
      @api = api
      @out = out
      @template_class = template_class
    end

    def start
      if parameter[:version]
        @out.puts "xploy #{VERSION}"
      elsif commands.empty?
        parameter.print_help!
      elsif commands.first == 'new'
        render_template
      else
        @out.puts @api.request(*commands)
      end
    rescue MissingParameter => e
      @out.puts e.message
    end

  private

    def parameter
      Xploy.parameter
    end

    def commands
      parameter.rest
    end

    def render_template
      template_data = @template_class.new.to_s
      if path = commands[1]
        File.open(path, 'w') { |f| f.write template_data }
      else
        @out.puts template_data
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08141702921068987, 'fraction_numerical': 0.001243008079552517, 'mean_word_length': 1.9925650557620818, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1825545', 'n_tokens_mistral': 494, 'n_tokens_neox': 484, 'n_words': 128}