lib/command/base.rb in cpl-0.5.1 vs lib/command/base.rb in cpl-0.6.0

- old
+ new

@@ -140,17 +140,28 @@ required: required } } end + def self.use_local_token_option(required: false) + { + name: :use_local_token, + params: { + desc: "Override remote CPLN_TOKEN with local token", + type: :boolean, + required: required + } + } + end + def self.all_options methods.grep(/_option$/).map { |method| send(method.to_s) } end def self.all_options_by_key_name all_options.each_with_object({}) do |option, result| - option[:params][:aliases].each { |current_alias| result[current_alias.to_s] = option } + option[:params][:aliases]&.each { |current_alias| result[current_alias.to_s] = option } result["--#{option[:name]}"] = option end end def wait_for(title) @@ -166,10 +177,10 @@ wait_for("workload to start") { cp.fetch_workload(workload) } end def wait_for_replica(workload, location) wait_for("replica") do - cp.workload_get_replicas(workload, location: location)&.dig("items", 0) + cp.workload_get_replicas_safely(workload, location: location)&.dig("items", 0) end end def ensure_workload_deleted(workload) progress.puts "- Ensure workload is deleted"