Class: Eien::CLI::Config
Instance Method Summary collapse
Methods inherited from CLI
Instance Method Details
#export ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/eien/cli/config.rb', line 31 def export rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) ::Eien::Config::ExportTask.new( context, app, [:name] || "default", ).run! end end |
#list ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/eien/cli/config.rb', line 13 def list rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) ::Eien::Config::ListTask.new( context, app, [:name] || "default", ).run! end end |
#set(*raw_key_pairs) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/eien/cli/config.rb', line 49 def set(*raw_key_pairs) rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) key_pairs = raw_key_pairs.each_with_object({}) do |raw_key_pair, key_pairs| key, value = raw_key_pair.split("=") key_pairs[key] = value end ::Eien::Config::UpdateTask.new( context, app, [:name] || "default", **key_pairs, ).run! end end |
#unset(*keys) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/eien/cli/config.rb', line 73 def unset(*keys) rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) key_pairs = keys.each_with_object({}) do |key, key_pairs| key_pairs[key] = nil end ::Eien::Config::UpdateTask.new( context, app, [:name] || "default", **key_pairs, ).run! end end |