class Fontist::ConfigCLI
Public Instance Methods
delete(key)
click to toggle source
# File lib/fontist/config_cli.rb, line 32 def delete(key) handle_class_options(options) Config.instance.delete(key) Fontist.ui.success( "'#{key}' reset to default ('#{Config.instance.default_value(key)}').", ) CLI::STATUS_SUCCESS end
keys()
click to toggle source
# File lib/fontist/config_cli.rb, line 42 def keys handle_class_options(options) Fontist.ui.say("Available keys:") Config.instance.default_values.each do |key, value| Fontist.ui.say("#{key} (default: #{value})") end CLI::STATUS_SUCCESS end
set(key, value)
click to toggle source
# File lib/fontist/config_cli.rb, line 21 def set(key, value) handle_class_options(options) Config.instance.set(key, value) Fontist.ui.success("'#{key}' set to '#{value}'.") CLI::STATUS_SUCCESS rescue Errors::InvalidConfigAttributeError => e Fontist.ui.error(e.message) CLI::STATUS_INVALID_CONFIG_ATTRIBUTE end
show()
click to toggle source
# File lib/fontist/config_cli.rb, line 6 def show handle_class_options(options) values = Config.instance.custom_values if values.empty? Fontist.ui.success("Config is empty.") else Fontist.ui.success("Current config:") Fontist.ui.success(format_hash(values)) end CLI::STATUS_SUCCESS end