Class: Translatomatic::CLI::Config

Inherits:
Base
  • Object
show all
Defined in:
lib/translatomatic/cli/config.rb

Overview

Configuration functions for the command line interface

Instance Method Summary collapse

Instance Method Details

#add(key, *value) ⇒ String

Add a configuration setting to a list

Parameters:

  • key (String)

    configuration key

  • value (String)

    value to add

Returns:

  • (String)

    the new value



43
44
45
# File 'lib/translatomatic/cli/config.rb', line 43

def add(key, *value)
  run { conf.add(key, value, config_params) }
end

#describeObject

Describe available configuration settings



73
74
75
76
77
# File 'lib/translatomatic/cli/config.rb', line 73

def describe
  run do
    print_config_table(columns: %i[key type desc])
  end
end

#listObject

List current configuration settings



63
64
65
66
67
# File 'lib/translatomatic/cli/config.rb', line 63

def list
  run do
    print_config_table(columns: %i[key value], skip_blanks: true)
  end
end

#set(key, *value) ⇒ String

Change a configuration setting

Parameters:

  • key (String)

    configuration key

  • value (String)

    new value for the configuration

Returns:

  • (String)

    the new value



22
23
24
# File 'lib/translatomatic/cli/config.rb', line 22

def set(key, *value)
  run { conf.set(key, value, config_params) }
end

#subtract(key, value) ⇒ void

This method returns an undefined value.

Remove a configuration setting from a list

Parameters:

  • key (String)

    configuration key

  • value (String)

    value to remove



54
55
56
# File 'lib/translatomatic/cli/config.rb', line 54

def subtract(key, value)
  run { conf.subtract(key, value, config_params) }
end

#unset(key) ⇒ void

This method returns an undefined value.

Remove a configuration setting

Parameters:

  • key (String)

    configuration key to remove



32
33
34
# File 'lib/translatomatic/cli/config.rb', line 32

def unset(key)
  run { conf.unset(key, config_params) }
end