]> git.decadent.org.uk Git - ion3.git/blob - mod_query/mod_query_chdir.lua
8c60cb1d67785207d4fbf96c4c97aaf1e751e3b9
[ion3.git] / mod_query / mod_query_chdir.lua
1 --
2 -- ion/query/mod_query_chdir.lua
3 -- 
4 -- Copyright (c) Tuomo Valkonen 2004-2007.
5 -- 
6 -- Ion is free software; you can redistribute it and/or modify it under
7 -- the terms of the GNU Lesser General Public License as published by
8 -- the Free Software Foundation; either version 2.1 of the License, or
9 -- (at your option) any later version.
10 --
11
12 local function ws_chdir(mplex, params)
13     ws=assert(ioncore.find_manager(mplex, "WGroupWS"))
14     local ok, err=ioncore.chdir_for(ws, params[1] or "")
15     if not ok then
16         mod_query.warn(mplex, err)
17     end
18 end
19
20 local function ws_showdir(mplex, params)
21     local dir=assert(ioncore.get_dir_for(mplex) or os.getenv("PWD"))
22     mod_query.message(mplex, dir)
23 end
24
25 mod_query.defcmd("cd", ws_chdir)
26 mod_query.defcmd("pwd", ws_showdir)