module Topt
Extend your class with this module to add Thor-like options methods.
This currently does not do any magical method based things, so you'll need to do one command per class or instantiate the parser directly.
Instantiating directly can really make your command easy to understand, since there is very little magic going on at that point.
Constants
- VERSION
Public Instance Methods
argument(name, options={})
click to toggle source
# File lib/topt.rb, line 41 def argument(name, options={}) attr_accessor name options_parser.argument(name, options) end
arguments()
click to toggle source
# File lib/topt.rb, line 37 def arguments options_parser.arguments end
option(name, options)
click to toggle source
# File lib/topt.rb, line 32 def option(name, options) options_parser.option(name, options) end
Also aliased as: method_option
options()
click to toggle source
# File lib/topt.rb, line 27 def options options_parser.options end
Also aliased as: method_options
options_parser()
click to toggle source
# File lib/topt.rb, line 23 def options_parser @parser ||= Parser.new end
parse_options!(given_args=ARGV, defaults_hash = {})
click to toggle source
# File lib/topt.rb, line 50 def parse_options!(given_args=ARGV, defaults_hash = {}) options_parser.parse(given_args, defaults_hash) end
remove_argument(*names)
click to toggle source
# File lib/topt.rb, line 46 def remove_argument(*names) options_parser.remove_argument(*nname) end