Sha256: d9de6ba8bd7522d31b5c658de9e951b0c817ac582616afcff73c1a139cbf4419

Contents?: true

Size: 546 Bytes

Versions: 5

Compression:

Stored size: 546 Bytes

Contents

module Unipept
  class Commands::Config < Cri::CommandRunner
    def run
      abort command.help if arguments.empty? || arguments.size > 2

      key, value = *arguments

      if arguments.size == 2
        set_config(key, value)
        puts "#{key} was set to #{value}"
      else
        puts get_config(key)
      end
    end

    def config
      @config ||= Unipept::Configuration.new
    end

    def set_config(key, value)
      config[key] = value
      config.save
    end

    def get_config(key)
      config[key]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unipept-3.1.0 lib/commands/unipept/config.rb
unipept-3.0.2 lib/commands/unipept/config.rb
unipept-3.0.1 lib/commands/unipept/config.rb
unipept-3.0.0 lib/commands/unipept/config.rb
unipept-2.2.2 lib/commands/unipept/config.rb