satelito

Static [web] site (or page) generator (ssg) made with Lua script.
git clone git://soucy.cc/satelito.git
Log | Files | Refs | README

commit e91a3fba1e0e8a38d9a2b9ccf3ea75abebf21a28
parent 33e2ec4a4b830ca15bf0d9465eeb472b548c4ef2
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sat,  9 Oct 2021 11:03:44 -0400

Test the exec command

Diffstat:
Msatelito/init.lua | 19+++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/satelito/init.lua b/satelito/init.lua @@ -13,6 +13,7 @@ local site = require 'satelito.site' local init local pipe local make +local exec local parser = argparse() :name 'satelito' @@ -28,9 +29,23 @@ pipe:flag('-e --export', 'Export the outputed HTML in the *config.paths.public_h -- Set 'make' command make = parser:command('make', 'Build the site from his directory.') make:flag('-e --export', 'Export the outputed HTML in the *config.paths.public_html* folder.') +-- Set the exec command +exec = parser:command('exec', 'Execute a script frome the bin directory') +exec:argument 'bin name' args = parser:parse() +if args['exec'] then + package.path = package.path .. ';'.. lfs.currentdir() ..'/?.lua' + + print(args['bin name'], inspect(lfs.currentdir())) + + if args['bin name'] then + dofile(lfs.currentdir() .. '/bin/'..args['bin name']) + end + +end + -- Example '$ satelito init' if args['init'] then os.execute('mkdir ~/satelito-sample') @@ -106,9 +121,8 @@ if args['pipe'] then templates = lume.array(dirtree.get(lfs.currentdir() .. '/' .. config.paths.templates)) print('=> Making the web site ...') - site.make(sitemap, templates, args['export'], timestart) - return + return site.make(sitemap, templates, args['export'], timestart) end -- Example: '$ satelito make --export' @@ -148,6 +162,7 @@ if args['make'] then templates = lume.array(dirtree.get(lfs.currentdir() .. '/' .. config.paths.templates)) print('=> Making the web site ...') + return site.make(sitemap, templates, args['export'], timestart) else print('There is no "config.lua" here.')