<commit_before>module BentoQemu
  class CLI < Thor

    desc 'build', 'Run packer build'
    method_option :packer_options,
                  :desc => <<-EOS.gsub(/^ {20}/, '').gsub(/\n/, ' ')
                    string of options to pass to packer,
                    e.g. "-var 'key1=val1' -var 'key2=val2'"
                  EOS
    method_option :skip_minimize,
                  :desc => <<-EOS.gsub(/^ {20}/, '').gsub(/\n/, ' ')
                    attempt to remove 'minimize.sh' script from template
                    before building
                  EOS
    def build(template)
      args = {}
      args[:packer_options] = options[:packer_options]
      args[:cwd] = config['bento_dir']
      args[:input] = template_minimize_stripped if options[:skip_minimize]
      Packer.build(template, args)
    end

    private

    def template_minimize_stripped
      template = PackerTemplate.new(:filename => template)
      template.strip_minimize
    end

  end
end<commit_msg>pass template absolute path to packer as cwd<commit_after>module BentoQemu
  class CLI < Thor

    desc 'build', 'Run packer build'
    method_option :packer_options,
                  :desc => <<-EOS.gsub(/^ {20}/, '').gsub(/\n/, ' ')
                    string of options to pass to packer,
                    e.g. "-var 'key1=val1' -var 'key2=val2'"
                  EOS
    method_option :skip_minimize,
                  :desc => <<-EOS.gsub(/^ {20}/, '').gsub(/\n/, ' ')
                    attempt to remove 'minimize.sh' script from template
                    before building
                  EOS
    def build(template)
      args = {}
      args[:packer_options] = options[:packer_options]
      args[:cwd] = File.absolute_path(template)
      args[:input] = template_minimize_stripped if options[:skip_minimize]
      Packer.build(template, args)
    end

    private

    def template_minimize_stripped
      template = PackerTemplate.new(:filename => template)
      template.strip_minimize
    end

  end
end
{'fraction_non_alphanumeric': 0.11866931479642502, 'fraction_numerical': 0.007944389275074478, 'mean_word_length': 1.9245283018867925, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, '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': '6583586', 'n_tokens_mistral': 639, 'n_tokens_neox': 596, 'n_words': 144}