Class: Toys::ArgParser::ToolUnrecognizedError

Inherits:
UsageError
  • Object
show all
Defined in:
lib/toys/arg_parser.rb

Overview

A UsageError indicating the given subtool name does not exist.

Instance Attribute Summary

Attributes inherited from UsageError

#message, #name, #suggestions, #value

Instance Method Summary collapse

Methods inherited from UsageError

#full_message

Constructor Details

#initialize(message = nil, value: nil, values: nil, suggestions: nil) ⇒ ToolUnrecognizedError

Create a ToolUnrecognizedError.

Parameters:

  • message (String, nil) (defaults to: nil)

    A custom message. Normally omitted, in which case an appropriate default is supplied.

  • value (String) (defaults to: nil)

    The requested subtool. Normally required.

  • values (Array<String>) (defaults to: nil)

    The full path of the requested tool. Normally required.

  • suggestions (Array<String>) (defaults to: nil)

    An array of suggestions to present to the user. Optional.



247
248
249
250
251
# File 'lib/toys/arg_parser.rb', line 247

def initialize(message = nil, value: nil, values: nil, suggestions: nil)
  super(message || "Tool not found: \"#{Array(values).join(' ')}\"",
        value: value, suggestions: suggestions)
  @name = name
end