class YleTfPlugins::CommandHelp::Command
Public Instance Methods
device(env)
click to toggle source
# File lib/yle_tf_plugins/commands/help/command.rb, line 41 def device(env) error?(env) ? STDERR : STDOUT end
error?(env)
click to toggle source
rubocop:enable Metrics/AbcSize, Metrics/MethodLength
# File lib/yle_tf_plugins/commands/help/command.rb, line 37 def error?(env) env[:tf_env] == 'error' end
execute(env)
click to toggle source
# File lib/yle_tf_plugins/commands/help/command.rb, line 10 def execute(env) device(env).puts(opts.help) exit 1 if error?(env) end
opts()
click to toggle source
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
# File lib/yle_tf_plugins/commands/help/command.rb, line 16 def opts OptionParser.new do |o| o.summary_width = 18 o.banner = 'Usage: tf <environment> <command> [<args>]' o.separator '' o.separator 'YleTf options:' o.on('-h', '--help', 'Prints this help') o.on('-v', '--version', 'Prints the version information') o.on('--debug', 'Print debug information') o.on('--no-color', 'Do not output with colors') o.on('--no-hooks', 'Do not run any hooks') o.on('--only-hooks', 'Only run the hooks') o.separator '' o.separator 'Special YleTf commands:' o.separator tf_command_help o.separator '' o.separator 'Run `terraform -help` to get list of all Terraform commands.' end end
tf_command_help()
click to toggle source
# File lib/yle_tf_plugins/commands/help/command.rb, line 45 def tf_command_help YleTf::Plugin.manager.commands.sort.map do |command, data| " #{command.ljust(18)} #{data[:synopsis]}" end end