Class: GLI::Commands::HelpModules::CommandFinder
- Inherits:
-
Object
- Object
- GLI::Commands::HelpModules::CommandFinder
- Defined in:
- lib/gli/commands/help_modules/command_finder.rb
Overview
Finds commands from the application/command data structures
Instance Attribute Summary collapse
-
#last_found_command ⇒ Object
readonly
Returns the value of attribute last_found_command.
-
#last_unknown_command ⇒ Object
readonly
Returns the value of attribute last_unknown_command.
-
#squelch_stderr ⇒ Object
writeonly
Sets the attribute squelch_stderr.
Instance Method Summary collapse
- #find_command(name) ⇒ Object
-
#initialize(app, arguments, error) ⇒ CommandFinder
constructor
A new instance of CommandFinder.
Constructor Details
#initialize(app, arguments, error) ⇒ CommandFinder
Returns a new instance of CommandFinder.
11 12 13 14 15 16 17 |
# File 'lib/gli/commands/help_modules/command_finder.rb', line 11 def initialize(app,arguments,error) @app = app @arguments = arguments @error = error @squelch_stderr = false @last_unknown_command = nil end |
Instance Attribute Details
#last_found_command ⇒ Object (readonly)
Returns the value of attribute last_found_command.
8 9 10 |
# File 'lib/gli/commands/help_modules/command_finder.rb', line 8 def last_found_command @last_found_command end |
#last_unknown_command ⇒ Object (readonly)
Returns the value of attribute last_unknown_command.
7 8 9 |
# File 'lib/gli/commands/help_modules/command_finder.rb', line 7 def last_unknown_command @last_unknown_command end |
#squelch_stderr=(value) ⇒ Object (writeonly)
Sets the attribute squelch_stderr
9 10 11 |
# File 'lib/gli/commands/help_modules/command_finder.rb', line 9 def squelch_stderr=(value) @squelch_stderr = value end |
Instance Method Details
#find_command(name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gli/commands/help_modules/command_finder.rb', line 19 def find_command(name) command = find_command_from_base(name,@app) return if unknown_command?(command,name,@error) @last_found_command = command while !@arguments.empty? name = @arguments.shift command = find_command_from_base(name,command) return if unknown_command?(command,name,@error) @last_found_command = command end command end |