diff options
author | Alexander Poslavsky <alexander.poslavsky@gmail.com> | 2007-11-02 14:55:11 +0000 |
---|---|---|
committer | Alexander Poslavsky <alexander.poslavsky@gmail.com> | 2007-11-02 14:55:11 +0000 |
commit | d49ec1941b5621f47662c422c0557d62385583bd (patch) | |
tree | 200fdc67b50c9dd8edf38cce1f12c90d65659b78 /app | |
parent | c54a2aafc967f0e599f6dbb6e4eef0ea1cd50bd4 (diff) | |
download | acf-core-d49ec1941b5621f47662c422c0557d62385583bd.tar.bz2 acf-core-d49ec1941b5621f47662c422c0557d62385583bd.tar.xz |
beginning of cli wrapper
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@262 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'app')
-rw-r--r-- | app/acf_cli-controller.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/app/acf_cli-controller.lua b/app/acf_cli-controller.lua new file mode 100644 index 0000000..2287067 --- /dev/null +++ b/app/acf_cli-controller.lua @@ -0,0 +1,60 @@ +module(..., package.seeall) + +-- We use the parent exception handler in a last-case situation +local parent_exception_handler + +mvc = {} +mvc.on_load = function (self, parent) + + -- Make sure we have some kind of sane defaults for libdir and sessiondir + self.conf.libdir = self.conf.libdir or ( self.conf.appdir .. "/lib/" ) + self.conf.sessiondir = self.conf.sessiondir or "/tmp/" + self.conf.appuri = "" + self.conf.default_controller = "welcome" + + parent_exception_handler = parent.exception_handler + + -- this sets the package path for us and our children + package.path= self.conf.libdir .. "?.lua;" .. package.path + + self.session = {} + local x=require("session") +end + +mvc.pre_exec = function () +end + +mvc.post_exec = function () +end + + +view_resolver = function(self) + return function (viewtable) + print(viewtable) + end +end + +exception_handler = function (self, message ) + print(message) +end + +-- create a Configuration Framework Entity (cfe) +-- returns a table with at least "value", "type", "option" and "errtxt" +cfe = function ( optiontable ) + optiontable = optiontable or {} + me = { value="", + type="text", + option="", + errtxt="", + name="" } + for key,value in pairs(optiontable) do + me[key] = value + end + return me +end + + +-- syslog something +logit = function ( ... ) + os.execute ( "logger \"" .. ... .. "\"" ) +end |