mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Add support for running the executables in Ruby without exiting.
This commit is contained in:
parent
ab289bd9e9
commit
002de89b3a
1 changed files with 16 additions and 6 deletions
|
@ -15,14 +15,11 @@ module Haml
|
|||
|
||||
# Parses the command-line arguments and runs the executable.
|
||||
# Calls `Kernel#exit` at the end, so it never returns.
|
||||
#
|
||||
# @see #parse
|
||||
def parse!
|
||||
begin
|
||||
@opts = OptionParser.new(&method(:set_opts))
|
||||
@opts.parse!(@args)
|
||||
|
||||
process_result
|
||||
|
||||
@options
|
||||
parse
|
||||
rescue Exception => e
|
||||
raise e if @options[:trace] || e.is_a?(SystemExit)
|
||||
|
||||
|
@ -32,6 +29,19 @@ module Haml
|
|||
exit 0
|
||||
end
|
||||
|
||||
# Parses the command-line arguments and runs the executable.
|
||||
# This does not handle exceptions or exit the program.
|
||||
#
|
||||
# @see #parse!
|
||||
def parse
|
||||
@opts = OptionParser.new(&method(:set_opts))
|
||||
@opts.parse!(@args)
|
||||
|
||||
process_result
|
||||
|
||||
@options
|
||||
end
|
||||
|
||||
# @return [String] A description of the executable
|
||||
def to_s
|
||||
@opts.to_s
|
||||
|
|
Loading…
Add table
Reference in a new issue