From c81669e0915d134439ddaec87572143b4e2a1b89 Mon Sep 17 00:00:00 2001 From: skywind3000 Date: Mon, 26 Nov 2018 00:01:23 +0800 Subject: [PATCH] fixed completion issues --- z.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/z.lua b/z.lua index bfb8e07..8a6318d 100644 --- a/z.lua +++ b/z.lua @@ -1061,7 +1061,9 @@ function main(argv) local M = z_match(args and args or {}, Z_METHOD, Z_SUBDIR) z_print(M) elseif options['--complete'] then - local M = z_match(args and args or {}, Z_METHOD, Z_SUBDIR) + local line = args[1] and args[1] or '' + local head = line:sub(Z_CMD:len()+1):gsub('^%s+', '') + local M = z_match({head}, Z_METHOD, Z_SUBDIR) for _, item in pairs(M) do print(item.name) end