stop_on_unknown_option!(*command_names)public
Stop parsing of options as soon as an unknown option or a regular argument is encountered. All remaining arguments are passed to the command. This is useful if you have a command that can receive arbitrary additional options, and where those additional options should not be handled by Bundler::Thor.
Example
To better understand how this is useful, let’s consider a command that calls an external command. A user may want to pass arbitrary options and arguments to that command. The command itself also accepts some options, which should be handled by Bundler::Thor.
class_option "verbose", :type => :boolean stop_on_unknown_option! :exec check_unknown_options! :except => :exec desc "exec", "Run a shell command" def exec(*args) puts "diagnostic output" if options[:verbose] Kernel.exec(*args) end
Here exec can be called with --verbose to get diagnostic output, e.g.:
$ thor exec --verbose echo foo diagnostic output foo
But if --verbose is given after echo, it is passed to echo instead:
$ thor exec echo --verbose foo --verbose foo
Parameters
Symbol … |
A list of commands that should be affected. |