On 2005-11-18, David Roundy <[EMAIL PROTECTED]> wrote:
> The catch is that there is no mod_query.query_directory, and I can't see
> how to construct such a beast. The only functions I can see are ones that
> seem either too high-level or too low-level. I'm sure I'm just missing
> something.
There's nothing that would complete directories only, so you have to use
the file completor if you don't want to do a lot of work.
mod_query.query_execfile is close then, but it expects a command string
as an argument, and here we want a continuation function (the queries are
asynchronous; they don't return the result). Something like the following
should work
function query_file(mplex, prompt, cnt)
local function handle_evalfile(mplex, str)
cnt(str)
end
return mod_query.query(mplex, prompt, mod_query.get_initdir(mplex),
handle_evalfile, mod_query.file_completor,
"filename")
end
You may of course simply want to pass mplex directly to cnt.
(The last parameter to mod_query.query is the history group name
in case you're wondering.)
--
Tuomo