Sha256: 8824e2d5437fbd2a01bb157271153a39c744458196d3241275c7a4ca09b79cb0
Contents?: true
Size: 944 Bytes
Versions: 39
Compression:
Stored size: 944 Bytes
Contents
module Seira module Commands class Gcloud attr_reader :context, :command, :format, :clean_output def initialize(command, context:, clean_output:, format:) @command = command @context = context @format = format @clean_output = clean_output end def invoke puts "Calling: #{calculated_command.green}" unless clean_output if format == :boolean system(calculated_command) elsif format == :json `#{calculated_command}` end end private def calculated_command @_calculated_command ||= begin rv = if format == :json "gcloud #{command} --format=json" else "gcloud #{command}" end unless context.nil? rv = "#{rv} --project=#{context[:project]}" end rv end end end end end
Version data entries
39 entries across 39 versions & 1 rubygems