<commit_before>require "keyring_liberator"
require "name_whisperer"

module Pod
  class Command
    class Keys

      class Set < Keys
        self.summary = "A set values for keys."

        self.description = <<-DESC
            Save a environment key to be added to your project on the next pod install.

            If a third argument is given then that will be used as the project name if
            you need to skip the project naming process.
        DESC

        self.arguments = ['key','value', 'project_name']

        def initialize(argv)
          @key_name = argv.shift_argument
          @key_value = argv.shift_argument
          @project_name = argv.shift_argument
          super
        end

        def validate!
          super
          verify_podfile_exists!
          help! "A key name is required to save." unless @key_name
          help! "A value is required for the key." unless @key_value
        end

        def run
          # set a key to a folder id in ~/.cocoapods/keys
          # info "Saving into the keychain."

          keyring = current_keyring
          keyring.keys << @key_name
          CocoaPodsKeys::KeyringLiberator.save_keyring keyring

          keyring.save @key_name, @key_value

          puts "Saved #{@key_name} to #{keyring.name}."
        end

        def current_keyring
          current_dir = Dir.getwd<commit_msg>Use new CLAide argument syntax.<commit_after>require "keyring_liberator"
require "name_whisperer"

module Pod
  class Command
    class Keys

      class Set < Keys
        self.summary = "A set values for keys."

        self.description = <<-DESC
            Save a environment key to be added to your project on the next pod install.

            If a third argument is given then that will be used as the project name if
            you need to skip the project naming process.
        DESC

        self.arguments = [CLAide::Argument.new('key', true),
                          CLAide::Argument.new('value', true),
                          CLAide::Argument.new('project_name', false)]

        def initialize(argv)
          @key_name = argv.shift_argument
          @key_value = argv.shift_argument
          @project_name = argv.shift_argument
          super
        end

        def validate!
          super
          verify_podfile_exists!
          help! "A key name is required to save." unless @key_name
          help! "A value is required for the key." unless @key_value
        end

        def run
          # set a key to a folder id in ~/.cocoapods/keys
          # info "Saving into the keychain."

          keyring = current_keyring
          keyring.keys << @key_name
          CocoaPodsKeys::KeyringLiberator.save_keyring keyring

          keyring.save @key_name, @key_value

          puts "Saved #{@key_name} to #{keyring.name}."
        end

        def current_keyring
          current_dir = Dir.getwd
{'fraction_non_alphanumeric': 0.06769759450171821, 'fraction_numerical': 0.0, 'mean_word_length': 1.8679802955665024, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, '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': '2104817', 'n_tokens_mistral': 812, 'n_tokens_neox': 777, 'n_words': 275}