completion: append / to directories

Here is a small patch that appends a / to directories names in bash completion,
it does not seems to add noticeable overhead, but I only tested it on my
(rather fast) system.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Maxime COSTE 2009-01-23 19:02:48 +01:00 committed by Julien Danjou
parent d08b04ce9d
commit 1276c215e7
1 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@
-- Grab environment we need
local io = io
local os = os
local table = table
local math = math
local print = print
@ -105,6 +106,9 @@ function bash(command, cur_pos, ncomp)
while true do
local line = c:read("*line")
if not line then break end
if os.execute("test -d " .. line) == 0 then
line = line .. "/"
end
table.insert(output, bash_escape(line))
end