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

Method execute

ruby/engine/openstudio_cli.rb:1909–1947  ·  view source on GitHub ↗

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

(sub_argv)

Source from the content-addressed store, hash-verified

1907 # @see #::CLI.help
1908 #
1909 def execute(sub_argv)
1910
1911 $logger.info "ListCommands, sub_argv = #{sub_argv}"
1912
1913 options = {}
1914
1915 opts = OptionParser.new do |o|
1916 o.banner = 'Usage: openstudio list_commands'
1917 o.separator ''
1918 o.separator 'Options:'
1919 o.separator ''
1920
1921 o.on('--quiet', "If --quiet is passed, list only the names of commands without the header") do
1922 options[:quiet] = true
1923 end
1924
1925 end
1926
1927 # Parse the options
1928 argv = parse_options(opts, sub_argv)
1929 return 0 if argv == nil
1930
1931 $logger.debug("ListCommands command: #{argv.inspect} #{options.inspect}")
1932
1933 # If anything else than --quiet is passed
1934 unless argv == []
1935 $logger.error 'Extra Arguments passed to the list_commands command, please refer to the help documentation.'
1936 return 1
1937 end
1938
1939 if options[:quiet]
1940 $logger.debug 'Creating a new CLI instance and calling help with list_all AND quiet enabled'
1941 ::CLI.new([]).help(true, true)
1942 else
1943 $logger.debug 'Creating a new CLI instance and calling help with list_all enabled'
1944 ::CLI.new([]).help(true)
1945 end
1946 0
1947 end
1948end
1949
1950

Callers

nothing calls this directly

Calls 5

parse_optionsFunction · 0.85
infoMethod · 0.80
debugMethod · 0.80
helpMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected