src/cli/openstudio_cli.rb
# Executes the standard help method with the list_all attribute set to true
#
# @param [Array] sub_argv Options passed to the list_all command from the user input
# @return [Fixnum] Return status
# @see #::CLI.help
#
Executes the standard help method with the list_all attribute set to true
Executes the standard help method with the list_all attribute set to true
def execute(sub_argv)
    $logger.info "ListCommands, sub_argv = #{sub_argv}"
    options = {}
    opts = OptionParser.new do |o|
      o.banner = 'Usage: openstudio list_commands'
      o.separator ''
      o.separator 'Options:'
      o.separator ''
      o.on('--quiet', "If --quiet is passed, list only the names of commands without the header") do
        options[:quiet] = true
      end
    end
    argv = parse_options(opts, sub_argv)
    return 0 if argv == nil
    $logger.debug("ListCommands command: #{argv.inspect} #{options.inspect}")
    unless argv == []
      $logger.error 'Extra Arguments passed to the list_commands command, please refer to the help documentation.'
      return 1
    end
    if options[:quiet]
      $logger.debug 'Creating a new CLI instance and calling help with list_all AND quiet enabled'
      ::CLI.new([]).help(true, true)
    else
      $logger.debug 'Creating a new CLI instance and calling help with list_all enabled'
      ::CLI.new([]).help(true)
    end
    0
  end
def execute ( sub_argv ) $logger . info "ListCommands, sub_argv = #{sub_argv}" options = { } opts = OptionParser . new do | o | o . banner = 'Usage: openstudio list_commands' o . separator '' o . separator 'Options:' o . separator '' o . on ( '--quiet' , "If --quiet is passed, list only the names of commands without the header" ) do options [ :quiet ] = true end end argv = parse_options ( opts , sub_argv ) return 0 if argv == nil $logger . debug ( "ListCommands command: #{argv.inspect} #{options.inspect}" ) unless argv == [ ] $logger . error 'Extra Arguments passed to the list_commands command, please refer to the help documentation.' return 1 end if options [ :quiet ] $logger . debug 'Creating a new CLI instance and calling help with list_all AND quiet enabled' :: CLI . new ( [ ] ) . help ( true , true ) else $logger . debug 'Creating a new CLI instance and calling help with list_all enabled' :: CLI . new ( [ ] ) . help ( true ) end 0 end
Executes the standard help method with the list_all attribute set to true
Executes the standard help method with the list_all attribute set to true
# Parse the options # If anything else than --quiet is passed
None
Fixnum
sub_argv
<not_specific>
<not_specific>
sub_argv Options passed to the list_all command from the user input
sub_argv Options passed to the list_all command from the user input
see
None