Exception: Cl::UnknownOption

Inherits:
Error
  • Object
show all
Defined in:
lib/cl/errors.rb

Constant Summary collapse

VALUE =
/=[^ ]*/

Constants inherited from Error

Error::MSGS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, str) ⇒ UnknownOption

Returns a new instance of UnknownOption.



47
48
49
50
51
# File 'lib/cl/errors.rb', line 47

def initialize(cmd, str)
  @cmd = cmd
  @opt = str.sub('invalid option: ', '').sub(VALUE, '')
  super(:unknown_option, opt)
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



43
44
45
# File 'lib/cl/errors.rb', line 43

def cmd
  @cmd
end

#optObject (readonly)

Returns the value of attribute opt.



43
44
45
# File 'lib/cl/errors.rb', line 43

def opt
  @opt
end

Instance Method Details

#suggestionsObject



53
54
55
# File 'lib/cl/errors.rb', line 53

def suggestions
  cmd.suggestions(opt)
end