Method: Commands::OptionWithArg#attach

Defined in:
lib/commands.rb

#attach(commands) ⇒ Object



1214
1215
1216
1217
1218
1219
1220
1221
# File 'lib/commands.rb', line 1214

def attach(commands)
  command = super(commands)
  if @pattern && ! @arg.match(@pattern) then
    raise RuntimeError, "Expected argument to #{@name} to match #{@pattern.inspect}, but it didn't"
  end
  command.option(@name, @field_symbol, @arg)
  return command
end