openstudiocore/src/cli/openstudio_cli.rb
def help(list_all=false, quiet=false)
    if quiet
      commands = ['-h','--help',
                  '--verbose',
                  '--no-ssl',
                  '-i', '--include',
                  '-e', '--execute',
                  '--gem_path', '--gem_home', '--bundle', '--bundle_path', '--bundle_without']
      command_list.each do |key, data|
        # Skip non-primary commands. These only show up in extended
        # help output.
        next unless data[1][:primary] unless list_all
        commands << key.to_s
      end
      safe_puts commands #.join(" ")

    else
      opts = OptionParser.new do |o|
        o.banner = 'Usage: openstudio [options] <command> [<args>]'
        o.separator ''
        o.on('-h', '--help', 'Print this help.')
        o.on('--verbose', 'Print the full log to STDOUT')
        o.on('--no-ssl', 'Skip initializing SSL')
        o.on('-I', '--include DIR', 'Add additional directory to add to front of Ruby $LOAD_PATH (may be used more than once)')
        o.on('-e', '--execute CMD', 'Execute one line of script (may be used more than once). Returns after executing commands.')
        o.on('--gem_path DIR', 'Add additional directory to add to front of GEM_PATH environment variable (may be used more than once)')
        o.on('--gem_home DIR', 'Set GEM_HOME environment variable')
        o.on('--bundle GEMFILE', 'Use bundler for GEMFILE')
        o.on('--bundle_path BUNDLE_PATH', 'Use bundler installed gems in BUNDLE_PATH')
        o.on('--bundle_without WITHOUT_GROUPS', 'Space separated list of groups for bundler to exclude in WITHOUT_GROUPS.  Surround multiple groups with quotes like "test development".')
        o.separator ''
        o.separator 'Common commands:'

        # Add the available commands as separators in order to print them
        # out as well.
        commands = {}
        longest = 0
        command_list.each do |key, data|
          # Skip non-primary commands. These only show up in extended
          # help output.
          next unless data[1][:primary] unless list_all

          key           = key.to_s
          klass         = data[0].call
          commands[key] = klass.synopsis
          longest       = key.length if key.length > longest
        end

        commands.keys.sort.each do |key|
          o.separator "     #{key.ljust(longest+2)} #{commands[key]}"
        end

        o.separator ''
        o.separator 'For help on any individual command run `openstudio COMMAND -h`'
        unless list_all
          o.separator ''
          o.separator 'Additional commands are available, but are either more advanced'
          o.separator 'or not commonly used. To see all commands, run the command'
          o.separator '`openstudio list_commands`.'
        end
      end

      safe_puts opts.help
    end
  end
# Prints out the help text for the CLI
#
# @param [Boolean] list_all If set to true, the help prints all commands, however it otherwise only prints those
#   marked as primary in #command_list
# @param [Boolean] quiet If set to true, list only the names of commands without the header
# @return [void]
# @see #command_list #::ListCommands
#
Prints out the help text for the CLI
Prints out the help text for the CLI
def help(list_all=false, quiet=false)
    if quiet
      commands = ['-h','--help',
                  '--verbose',
                  '--no-ssl',
                  '-i', '--include',
                  '-e', '--execute',
                  '--gem_path', '--gem_home', '--bundle', '--bundle_path', '--bundle_without']
      command_list.each do |key, data|
        next unless data[1][:primary] unless list_all
        commands << key.to_s
      end
      safe_puts commands 
    else
      opts = OptionParser.new do |o|
        o.banner = 'Usage: openstudio [options] <command> [<args>]'
        o.separator ''
        o.on('-h', '--help', 'Print this help.')
        o.on('--verbose', 'Print the full log to STDOUT')
        o.on('--no-ssl', 'Skip initializing SSL')
        o.on('-I', '--include DIR', 'Add additional directory to add to front of Ruby $LOAD_PATH (may be used more than once)')
        o.on('-e', '--execute CMD', 'Execute one line of script (may be used more than once). Returns after executing commands.')
        o.on('--gem_path DIR', 'Add additional directory to add to front of GEM_PATH environment variable (may be used more than once)')
        o.on('--gem_home DIR', 'Set GEM_HOME environment variable')
        o.on('--bundle GEMFILE', 'Use bundler for GEMFILE')
        o.on('--bundle_path BUNDLE_PATH', 'Use bundler installed gems in BUNDLE_PATH')
        o.on('--bundle_without WITHOUT_GROUPS', 'Space separated list of groups for bundler to exclude in WITHOUT_GROUPS.  Surround multiple groups with quotes like "test development".')
        o.separator ''
        o.separator 'Common commands:'
        commands = {}
        longest = 0
        command_list.each do |key, data|
          next unless data[1][:primary] unless list_all
          key           = key.to_s
          klass         = data[0].call
          commands[key] = klass.synopsis
          longest       = key.length if key.length > longest
        end
        commands.keys.sort.each do |key|
          o.separator "     #{key.ljust(longest+2)} #{commands[key]}"
        end
        o.separator ''
        o.separator 'For help on any individual command run `openstudio COMMAND -h`'
        unless list_all
          o.separator ''
          o.separator 'Additional commands are available, but are either more advanced'
          o.separator 'or not commonly used. To see all commands, run the command'
          o.separator '`openstudio list_commands`.'
        end
      end
      safe_puts opts.help
    end
  end
def help ( list_all = false , quiet = false ) if quiet commands = [ '-h' , '--help' , '--verbose' , '--no-ssl' , '-i' , '--include' , '-e' , '--execute' , '--gem_path' , '--gem_home' , '--bundle' , '--bundle_path' , '--bundle_without' ] command_list . each do | key , data | next unless data [ 1 ] [ :primary ] unless list_all commands << key . to_s end safe_puts commands else opts = OptionParser . new do | o | o . banner = 'Usage: openstudio [options] <command> [<args>]' o . separator '' o . on ( '-h' , '--help' , 'Print this help.' ) o . on ( '--verbose' , 'Print the full log to STDOUT' ) o . on ( '--no-ssl' , 'Skip initializing SSL' ) o . on ( '-I' , '--include DIR' , 'Add additional directory to add to front of Ruby $LOAD_PATH (may be used more than once)' ) o . on ( '-e' , '--execute CMD' , 'Execute one line of script (may be used more than once). Returns after executing commands.' ) o . on ( '--gem_path DIR' , 'Add additional directory to add to front of GEM_PATH environment variable (may be used more than once)' ) o . on ( '--gem_home DIR' , 'Set GEM_HOME environment variable' ) o . on ( '--bundle GEMFILE' , 'Use bundler for GEMFILE' ) o . on ( '--bundle_path BUNDLE_PATH' , 'Use bundler installed gems in BUNDLE_PATH' ) o . on ( '--bundle_without WITHOUT_GROUPS' , 'Space separated list of groups for bundler to exclude in WITHOUT_GROUPS.  Surround multiple groups with quotes like "test development".' ) o . separator '' o . separator 'Common commands:' commands = { } longest = 0 command_list . each do | key , data | next unless data [ 1 ] [ :primary ] unless list_all key = key . to_s klass = data [ 0 ] . call commands [ key ] = klass . synopsis longest = key . length if key . length > longest end commands . keys . sort . each do | key | o . separator "     #{key.ljust(longest+2)} #{commands[key]}" end o . separator '' o . separator 'For help on any individual command run `openstudio COMMAND -h`' unless list_all o . separator '' o . separator 'Additional commands are available, but are either more advanced' o . separator 'or not commonly used. To see all commands, run the command' o . separator '`openstudio list_commands`.' end end safe_puts opts . help end end
Prints out the help text for the CLI
Prints out the help text for the CLI
# Skip non-primary commands. These only show up in extended # help output. #.join(" ") # Add the available commands as separators in order to print them # out as well. # Skip non-primary commands. These only show up in extended # help output.
None
void
list_all
quiet
quiet If set to true, list only the names of commands without the header
quiet If set to true list only the names of commands without the header
see
None