Method: Rex::Ui::Text::DispatcherShell::CommandDispatcher#tab_complete_filenames
- Defined in:
- lib/rex/ui/text/dispatcher_shell.rb
#tab_complete_filenames(str, words) ⇒ Object
Provide a generic tab completion for file names.
If the only completion is a directory, this descends into that directory and continues completions with filenames contained within.
287 288 289 290 291 292 293 294 295 |
# File 'lib/rex/ui/text/dispatcher_shell.rb', line 287 def tab_complete_filenames(str, words) matches = ::Readline::FILENAME_COMPLETION_PROC.call(str) if matches and matches.length == 1 and File.directory?(matches[0]) dir = matches[0] dir += File::SEPARATOR if dir[-1,1] != File::SEPARATOR matches = ::Readline::FILENAME_COMPLETION_PROC.call(dir) end matches.nil? ? [] : matches end |