MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / help

Method help

ruby/engine/openstudio_cli.rb:816–878  ·  view source on GitHub ↗

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

(list_all=false, quiet=false)

Source from the content-addressed store, hash-verified

814 # @see #command_list #::ListCommands
815 #
816 def help(list_all=false, quiet=false)
817 if quiet
818 commands = ['-h','--help',
819 '--verbose',
820 '-i', '--include',
821 '-e', '--execute',
822 '--gem_path', '--gem_home', '--bundle', '--bundle_path', '--bundle_without']
823 command_list.each do |key, data|
824 # Skip non-primary commands. These only show up in extended
825 # help output.
826 next unless data[1][:primary] unless list_all
827 commands << key.to_s
828 end
829 safe_puts commands #.join(" ")
830
831 else
832 opts = OptionParser.new do |o|
833 o.banner = 'Usage: openstudio [options] <command> [<args>]'
834 o.separator ''
835 o.on('-h', '--help', 'Print this help.')
836 o.on('--verbose', 'Print the full log to STDOUT')
837 o.on('-I', '--include DIR', 'Add additional directory to add to front of Ruby $LOAD_PATH (may be used more than once)')
838 o.on('-e', '--execute CMD', 'Execute one line of script (may be used more than once). Returns after executing commands.')
839 o.on('--gem_path DIR', 'Add additional directory to add to front of GEM_PATH environment variable (may be used more than once)')
840 o.on('--gem_home DIR', 'Set GEM_HOME environment variable')
841 o.on('--bundle GEMFILE', 'Use bundler for GEMFILE')
842 o.on('--bundle_path BUNDLE_PATH', 'Use bundler installed gems in BUNDLE_PATH')
843 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".')
844 o.separator ''
845 o.separator 'Common commands:'
846
847 # Add the available commands as separators in order to print them
848 # out as well.
849 commands = {}
850 longest = 0
851 command_list.each do |key, data|
852 # Skip non-primary commands. These only show up in extended
853 # help output.
854 next unless data[1][:primary] unless list_all
855
856 key = key.to_s
857 klass = data[0].call
858 commands[key] = klass.synopsis
859 longest = key.length if key.length > longest
860 end
861
862 commands.keys.sort.each do |key|
863 o.separator " #{key.ljust(longest+2)} #{commands[key]}"
864 end
865
866 o.separator ''
867 o.separator 'For help on any individual command run `openstudio COMMAND -h`'
868 unless list_all
869 o.separator ''
870 o.separator 'Additional commands are available, but are either more advanced'
871 o.separator 'or not commonly used. To see all commands, run the command'
872 o.separator '`openstudio list_commands`.'
873 end

Callers 6

parse_optionsFunction · 0.80
executeMethod · 0.80
executeMethod · 0.80
GenerateClass.rbFile · 0.80

Calls 6

safe_putsFunction · 0.85
to_sMethod · 0.80
synopsisMethod · 0.45
lengthMethod · 0.45
sortMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected