From de89f239364a2e96b72958a078b7789f431126c3 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 12 Jan 2012 16:29:46 +0100 Subject: renamed acf_cli to acf-cli better do it now. later it will be impossible --- bin/Makefile | 4 ++-- bin/acf-cli | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/acf_cli | 53 ----------------------------------------------------- 3 files changed, 55 insertions(+), 55 deletions(-) create mode 100755 bin/acf-cli delete mode 100755 bin/acf_cli diff --git a/bin/Makefile b/bin/Makefile index 5b59fbf..53be97a 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,6 +1,6 @@ include ../config.mk -BIN_DIST=acf_cli acfpasswd +BIN_DIST=acf-cli acfpasswd EXTRA_DIST=Makefile DISTFILES=$(BIN_DIST) $(EXTRA_DIST) @@ -30,6 +30,6 @@ install: dest=`dirname "$(install_dir)/$$i"`;\ install -Dm755 "$$i" "$$dest"/$$i ;\ done - chmod 700 $(install_dir)/acf_cli + chmod 700 $(install_dir)/acf-cli .PHONY: $(phony) diff --git a/bin/acf-cli b/bin/acf-cli new file mode 100755 index 0000000..4ef512e --- /dev/null +++ b/bin/acf-cli @@ -0,0 +1,53 @@ +#!/usr/bin/lua +if #arg == 0 then + print([[ACF Client interface + +Usage: acf_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: +acf_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 +mvc = require("acf.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() diff --git a/bin/acf_cli b/bin/acf_cli deleted file mode 100755 index 4ef512e..0000000 --- a/bin/acf_cli +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/lua -if #arg == 0 then - print([[ACF Client interface - -Usage: acf_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: -acf_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 -mvc = require("acf.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