From 4f20915996f62a4890c315138a250a5a42d28877 Mon Sep 17 00:00:00 2001 From: dvs1 Date: Mon, 4 Nov 2024 15:40:51 +1000 Subject: Search for the README.md file when help is asked for. --- PolygLua.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'PolygLua.lua') diff --git a/PolygLua.lua b/PolygLua.lua index 5305872..e4cf6db 100755 --- a/PolygLua.lua +++ b/PolygLua.lua @@ -42,6 +42,16 @@ local optionsCommon = { help = {help = 'Print the help text.', func = function(self, options, a, args, i) + for i,v in ipairs{'/usr/share/doc/', '/usr/local/share/doc/', './'} do + local p = v .. 'README.md' + local h = io.open(p, 'r') + if nil ~= h then + D('Found README file '.. p) + Help = h:read('*a') + h:close() + end + end + print(Help) _.usage(args, options, true) os.exit(0) -- cgit v1.1