Class: Fontist::ConfigCLI

Inherits:
Thor
  • Object
show all
Includes:
Fontist::CLI::ClassOptions
Defined in:
lib/fontist/config_cli.rb

Constant Summary collapse

STATUS_SUCCESS =
0

Instance Method Summary collapse

Methods included from Fontist::CLI::ClassOptions

#handle_class_options, included, #log_level

Instance Method Details

#delete(key) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fontist/config_cli.rb', line 25

def delete(key)
  handle_class_options(options)
  Config.instance.delete(key)
  Fontist.ui.success(
    "'#{key}' reset to default ('#{Config.instance.default_value(key)}').",
  )
  STATUS_SUCCESS
end

#set(key, value) ⇒ Object



17
18
19
20
21
22
# File 'lib/fontist/config_cli.rb', line 17

def set(key, value)
  handle_class_options(options)
  Config.instance.set(key, value)
  Fontist.ui.success("'#{key}' set to '#{value}'.")
  STATUS_SUCCESS
end

#showObject



8
9
10
11
12
13
14
# File 'lib/fontist/config_cli.rb', line 8

def show
  handle_class_options(options)
  values = Config.instance.custom_values
  Fontist.ui.success("Current config:")
  Fontist.ui.success(format_hash(values))
  STATUS_SUCCESS
end