command_kit.rb
command_kit.rb copied to clipboard
Add a `CommandKit::Options::Type` base class
Add a CommandKit::Options::Type base class to make it easier to define custom OptionParser.accept types.
Example
class CustomType < CommandKit::Options::Type
usage 'CUSTOM'
pattern /.../
def self.parse(value)
# ...
end
end
Options::Types.register CustomType
The register method would simply call OptionParser.accept and populate the USAGE Hash:
OptionParser.accept(type, type.pattern, &type.method(:parse))