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)
| 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 |
| 1948 | end |
| 1949 | |
| 1950 |
nothing calls this directly
no test coverage detected