From 62d8725d99c4061ae60f7aa2028b3c7266641af4 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Thu, 24 Feb 2022 18:19:54 -0400 Subject: [PATCH] refactor: remove global module from doc command (closes #90) --- preload.lua | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/preload.lua b/preload.lua index 3a6148a..67c5306 100644 --- a/preload.lua +++ b/preload.lua @@ -50,8 +50,6 @@ end) commander.register('doc', function(args) local moddocPath = hilbish.dataDir .. '/docs/' - local globalDesc = [[ -These are the global Hilbish functions that are always available and not part of a module.]] local modDocFormat = [[ %s %s @@ -101,19 +99,17 @@ These are the global Hilbish functions that are always available and not part of end end)) - if mod == 'global' or ok then + if ok then local props = {} local propstr = '' - local modDesc = globalDesc - if ok then - local modmt = getmetatable(require(mod)) - modDesc = modmt.__doc - if modmt.__docProp then - -- not all modules have docs for properties - props = table.map(modmt.__docProp, function(v, k) - return lunacolors.underline(lunacolors.blue(k)) .. ' > ' .. v - end) - end + local modDesc = '' + local modmt = getmetatable(require(mod)) + modDesc = modmt.__doc + if modmt.__docProp then + -- not all modules have docs for properties + props = table.map(modmt.__docProp, function(v, k) + return lunacolors.underline(lunacolors.blue(k)) .. ' > ' .. v + end) end if #props > 0 then propstr = '\n# Properties\n' .. table.concat(props, '\n') .. '\n'