class TerraformLandscape::CLI
Command line application interface.
Public Class Methods
new(output)
click to toggle source
# File lib/terraform_landscape/cli.rb, line 8 def initialize(output) @output = output end
Public Instance Methods
run(_args)
click to toggle source
Parses the given command line arguments and executes appropriate logic based on those arguments.
@param args [Array<String>] command line arguments
@return [Integer] exit status code
# File lib/terraform_landscape/cli.rb, line 18 def run(_args) program :name, 'Terraform Landscape' program :version, VERSION program :description, 'Pretty-print your Terraform plan output' define_commands run! 0 # OK end
Private Instance Methods
define_commands()
click to toggle source
# File lib/terraform_landscape/cli.rb, line 31 def define_commands command :print do |c| c.action do |_args, options| print(options.__hash__) end c.description = <<-TXT Pretty-prints your Terraform plan output. If an error occurs while parsing the Terraform output, print will automatically fall back on the original Terraform output. To view the stack trace instead, provide the global --trace option. TXT end global_option '--no-color', 'Do not output any color' do String.disable_colorization = true @output.color_enabled = false end default_command :print end
print(options)
click to toggle source
# File lib/terraform_landscape/cli.rb, line 51 def print(options) printer = Printer.new(@output) printer.process_stream(ARGF, options) end