From 42750f022f4b2b9a9df6237c0981fdd479f4532d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 30 Aug 2011 20:13:24 +0000 Subject: Moved mvc.lua into /usr/share/lua and cli to /usr/bin/acf_cli --- www/cgi-bin/cli | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100755 www/cgi-bin/cli (limited to 'www/cgi-bin/cli') diff --git a/www/cgi-bin/cli b/www/cgi-bin/cli deleted file mode 100755 index 437a211..0000000 --- a/www/cgi-bin/cli +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/lua -if #arg == 0 then - print([[ACF Client interface - -Usage: cli [action] [parameter]... - -Actions are of the form "prefix/controller/action" -Parameters are of the form "parameter=value" - list and multi select parameters are of the form "parameter[1]=value" - boolean parameters are true if defined, false is undefined - -Example: -cli acf-util/password/newuser password="test123" password_confirm="test123" roles[1]="ADMIN" userid="root" Create - -For forms, remember to pass in the "option" value as a parameter (see Create in example above). -Output will be a serialized Lua table. - ]]) - return -end - -require("posix") -local PATH = package.path -local p = posix.dirname(arg[0]) -if p:sub(1,1) ~= "/" then p = posix.getcwd().."/"..p end -package.path = p.."/?.lua;" .. package.path -require("mvc") -package.path = PATH - --- this is to get around having to store --- the config file in /etc/helloworld/helloworld.conf -ENV={} -ENV.HOME="." -FRAMEWORK=mvc:new() -FRAMEWORK:read_config("acf") -APP=FRAMEWORK:new("acf_cli") - --- command line will have URI-type string defining prefix/controller/action --- (put into ENV.PATH_INFO) --- followed by parameters --- (put into APP.clientdata) -ENV.PATH_INFO = arg[1] -APP.clientdata = {} -for i=2,#arg do - a,v = string.match(arg[i], "([^=]*)=(.*)") - if v then - APP.clientdata[a] = v - else - APP.clientdata[arg[i]] = true - end -end -APP:dispatch() -APP:destroy() -FRAMEWORK:destroy() -- cgit v1.2.3