commit a8436536f1fba7500cce2cf29648c29d24d19280
parent c37df86ab52cda9510d255e0f8a4e1110758e374
Author: Hugo Soucy <hugo@soucy.cc>
Date: Mon, 3 Apr 2023 09:34:32 -0400
Add the --verbose flag
Displays in the terminal the source and destination of each content.
Diffstat:
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/satelito/init.lua b/satelito/init.lua
@@ -31,9 +31,10 @@ 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.')
+make:flag('-v --verbose', 'Displays in the terminal the source and destination of each content.')
-- Set the exec command
-exec = parser:command('exec', 'Execute a script frome the bin directory')
+exec = parser:command('exec', 'Execute a script from the site\'s bin directory.')
exec:argument 'bin name'
args = parser:parse()
@@ -149,6 +150,7 @@ end
-- Example: '$ satelito make --export'
if args['make'] then
local contentdir = _G.Satelito.contentdir
+ local verbose = _G.Satelito.args['verbose']
local sitedata = {}
print('=> Fetching the markdown and HTML content ...')
diff --git a/satelito/site.lua b/satelito/site.lua
@@ -36,6 +36,7 @@ function site.make(sitedata)
local config = _G.Satelito.config
local contentdir = _G.Satelito.contentdir
local export = _G.Satelito.args['export']
+ local verbose = _G.Satelito.args['verbose']
local make = _G.Satelito.args['make']
local publicdir = _G.Satelito.publicdir
local templates = _G.Satelito.templates
@@ -46,7 +47,9 @@ function site.make(sitedata)
local feed_xml, feed_xml_path
local paginated
- io.write('-- ' .. sitedata[i].relpath)
+ if verbose then
+ io.write(' ¬ ./' .. config.paths.content..sitedata[i].relpath)
+ end
sitedata[i].index = i
@@ -138,7 +141,9 @@ function site.make(sitedata)
assets.export(sitedata[i])
end
- io.write(' => '.. sitedata[i].rellink .. ' ✔ \n')
+ if verbose then
+ io.write(' > ./'.. config.paths.public_html:sub(1, -2) .. sitedata[i].rellink .. ' ✔ \n')
+ end
end
-- Make and export the sitemap.xml