hpcugent / Lmod-UGent

spec files of Lmod for UGent-HPC
8 stars 7 forks source link

Hide cluster modules with hook #38

Open wpoely86 opened 4 years ago

wpoely86 commented 4 years ago

Instead of patching Lmod to hide the cluster modules, you can also use a hook.

Untested code below:

local function visible_hook(modT)
    -- modT is a table with: fullName, sn, fn and isVisible
    -- The latter is a boolean to determine if a module is visible or not

    if modT.fullName:find("cluster/%.") then
        modT.isVisible = false
    end
end

hook.register("isVisibleHook", visible_hook)
wpoely86 commented 4 years ago

Working and deployed example: https://github.com/sisc-hpc/Lmod-UGent/blob/master/SitePackage.lua#L222-L231