lib/kubes/cli/base.rb in kubes-0.3.5 vs lib/kubes/cli/base.rb in kubes-0.4.0

- old
+ new

@@ -7,7 +7,18 @@ end def compile Compile.new(@options).run unless @options[:compile] == false end + + def pod_name + return unless @options[:pod] + + pods = Kubes::Kubectl::Fetch::Pods.new(@options) + items = pods.fetch(:pod) + metas = items.map { |i| i['metadata'] } + metas.select! { |i| i['name'].include?(@options[:pod]) } + meta = metas.sort { i['creationTimestamp'] }.last + meta['name'] if meta + end end end