lib/ruby_terraform/commands/output.rb in ruby-terraform-0.65.0.pre.4 vs lib/ruby_terraform/commands/output.rb in ruby-terraform-0.65.0.pre.5
- old
+ new
@@ -2,32 +2,25 @@
require_relative 'base'
module RubyTerraform
module Commands
class Output < Base
- def initialize(**kwargs)
- super(**kwargs)
- @stdout = StringIO.new unless
- defined?(@stdout) && @stdout.respond_to?(:string)
+ def initialize_command
+ return if defined?(@stdout) && @stdout.respond_to?(:string)
+
+ @stdout = StringIO.new
end
- def configure_command(builder, opts)
- name = opts[:name]
- state = opts[:state]
- no_color = opts[:no_color]
- json = opts[:json]
- mod = opts[:module]
+ def switches
+ %w[-json -raw -no-color -state -module]
+ end
- builder = builder
- .with_subcommand('output') do |sub|
- sub = sub.with_flag('-no-color') if no_color
- sub = sub.with_flag('-json') if json
- sub = sub.with_option('-state', state) if state
- sub = sub.with_option('-module', mod) if mod
- sub
- end
- builder = builder.with_argument(name) if name
- builder
+ def sub_commands(_values)
+ 'output'
+ end
+
+ def arguments(values)
+ values[:name]
end
def do_after(opts)
result = stdout.string
opts[:name] ? result.chomp : result