<commit_before>require "heroku/command/base"

module Heroku::Command

  # manage app config vars
  #
  class Config < Base

    # config
    #
    # display the config vars for an app
    #
    # -s, --shell  # output config vars in shell format
    #
    def index
      shell = options[:shell]
      vars  = heroku.config_vars(app)
      display_vars(vars, :long => true, :shell => shell)
    end

    # config:add KEY1=VALUE1 ...
    #
    # add one or more config vars
    #
    def add
      unless args.size > 0 and args.all? { |a| a.include?('=') }
        raise CommandFailed, "Usage: heroku config:add <key>=<value> [<key2>=<value2> ...]"
      end

      vars = args.inject({}) do |vars, arg|
        key, value = arg.split('=', 2)
        vars[key] = value
        vars
      end

      # try to get the app to fail fast
      detected_app = app

      display "Adding config vars and restarting app...", false
      heroku.add_config_vars(detected_app, vars)
      display " done", false

      begin
        release = heroku.releases(detected_app).last
        display(", #{release["name"]}", false) if release
      rescue RestClient::RequestFailed => e
      end

      display
      display_vars(vars, :indent => 2)
    end

    alias_command "config:set", "config:add"

    # config:remove KEY1 [KEY2 ...]
    #
    # remove a config var
    #
    def remove
      raise CommandFailed, "Usage: heroku config:remove KEY1 [KEY2 ...]" if args.empty?

      args.each do |key|
        display "Removing #{key} and restarting app...", false
        heroku.remove_config_var(app, key)

        display " done", false
        begin
          release = heroku.releases(app).last
          display(", #{release["name"]}", false) if release
        rescue RestClient::RequestFailed => e
        end
        display ".\n"
      end
    end

    protected
      def display_vars(vars, options={})<commit_msg>remove inconsistent . after version in config:remove closes heroku/dx#120<commit_after>require "heroku/command/base"

module Heroku::Command

  # manage app config vars
  #
  class Config < Base

    # config
    #
    # display the config vars for an app
    #
    # -s, --shell  # output config vars in shell format
    #
    def index
      shell = options[:shell]
      vars  = heroku.config_vars(app)
      display_vars(vars, :long => true, :shell => shell)
    end

    # config:add KEY1=VALUE1 ...
    #
    # add one or more config vars
    #
    def add
      unless args.size > 0 and args.all? { |a| a.include?('=') }
        raise CommandFailed, "Usage: heroku config:add <key>=<value> [<key2>=<value2> ...]"
      end

      vars = args.inject({}) do |vars, arg|
        key, value = arg.split('=', 2)
        vars[key] = value
        vars
      end

      # try to get the app to fail fast
      detected_app = app

      display "Adding config vars and restarting app...", false
      heroku.add_config_vars(detected_app, vars)
      display " done", false

      begin
        release = heroku.releases(detected_app).last
        display(", #{release["name"]}", false) if release
      rescue RestClient::RequestFailed => e
      end

      display
      display_vars(vars, :indent => 2)
    end

    alias_command "config:set", "config:add"

    # config:remove KEY1 [KEY2 ...]
    #
    # remove a config var
    #
    def remove
      raise CommandFailed, "Usage: heroku config:remove KEY1 [KEY2 ...]" if args.empty?

      args.each do |key|
        display "Removing #{key} and restarting app...", false
        heroku.remove_config_var(app, key)

        display " done", false
        begin
          release = heroku.releases(app).last
          display(", #{release["name"]}", false) if release
        rescue RestClient::RequestFailed => e
        end
        display
      end
    end

    protected
      def display_vars(vars, options={})
{'fraction_non_alphanumeric': 0.11804123711340206, 'fraction_numerical': 0.006443298969072165, 'mean_word_length': 2.1501623376623376, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, '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': '7363536', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1155, 'n_words': 351}