lib/gli/app_support.rb in gli-2.6.0.rc1 vs lib/gli/app_support.rb in gli-2.6.0
- old
+ new
@@ -29,10 +29,14 @@
@around_block = nil
@subcommand_option_handling_strategy = :legacy
clear_nexts
end
+ def exe_name
+ File.basename($0)
+ end
+
# Get an array of commands, ordered by when they were declared
def commands_declaration_order # :nodoc:
@commands_declaration_order
end
@@ -69,11 +73,15 @@
parsing_result = gli_option_parser.parse_options(args)
parsing_result.convert_to_openstruct! if @use_openstruct
the_command = parsing_result.command
- call_command(parsing_result) if proceed?(parsing_result)
- 0
+ if proceed?(parsing_result)
+ call_command(parsing_result)
+ 0
+ else
+ exit_now!(nil,65)
+ end
rescue Exception => ex
if the_command.nil? && ex.respond_to?(:command_in_context)
the_command = ex.command_in_context
end
handle_exception(ex,the_command)