Method: Rex::Ui::Text::DispatcherShell#tab_complete_helper

Defined in:
lib/rex/ui/text/dispatcher_shell.rb

#tab_complete_helper(dispatcher, str, words) ⇒ Object

Provide command-specific tab completion



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/rex/ui/text/dispatcher_shell.rb', line 351

def tab_complete_helper(dispatcher, str, words)
  items = []

  tabs_meth = "cmd_#{words[0]}_tabs"
  # Is the user trying to tab complete one of our commands?
  if (dispatcher.commands.include?(words[0]) and dispatcher.respond_to?(tabs_meth))
    res = dispatcher.send(tabs_meth, str, words)
    return [] if res.nil?
    items.concat(res)
  else
    # Avoid the default completion list for known commands
    return []
  end

  return items
end