tab complete local filenames for upload command
git-svn-id: file:///home/svn/framework3/trunk@11575 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
1e3df538f9
commit
0158cd28f1
|
@ -428,6 +428,12 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|||
return true
|
||||
end
|
||||
|
||||
def cmd_upload_tabs(str, words)
|
||||
return [] if words.length > 1
|
||||
|
||||
tab_complete_filenames(str, words)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -84,6 +84,22 @@ module DispatcherShell
|
|||
#
|
||||
attr_accessor :shell, :tab_complete_items
|
||||
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
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
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -206,22 +222,6 @@ module DispatcherShell
|
|||
return items
|
||||
end
|
||||
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
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
|
||||
end
|
||||
|
||||
#
|
||||
# Run a single command line.
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue