Method: WavefrontCommandBase#options

Defined in:
lib/wavefront-cli/commands/base.rb

#options(term_width = TW) ⇒ String

rubocop:disable Metrics/AbcSize

Parameters:

  • term_width (Integer) (defaults to: TW)

    force a terminal width. Makes testing far simpler.

Returns:

  • (String)

    the options the command understands.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/wavefront-cli/commands/base.rb', line 114

def options(term_width = TW)
  width = option_column_width
  ret = ''

  unless global_options.empty?
    ret.<< "Global options:\n"
    global_options.each { |o| ret.<< opt_row(o, width, term_width) }
    ret.<< "\n"
  end

  ret.<< "Options:\n"
  _options.flatten.each { |o| ret.<< opt_row(o, width, term_width) }
  ret
end