From 581b96352e1c98a35511555f1ba57c152a5df31f Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 15 Feb 2023 09:47:52 -0500 Subject: docs: make sure username doesn't leak into generated document (#2441) * docs: make sure username doesn't leak into generated document The documents previously contained `runner`, the username of GitHub Actions runners, which would be overwritten by the user's name when run locally and generate unwanted diff. * docs: rename username to user Co-authored-by: Justin M. Keyes --------- Co-authored-by: Justin M. Keyes --- scripts/docgen.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts/docgen.lua') diff --git a/scripts/docgen.lua b/scripts/docgen.lua index 93d57eb0..119353ba 100644 --- a/scripts/docgen.lua +++ b/scripts/docgen.lua @@ -82,11 +82,21 @@ require'lspconfig'.{{template_name}}.setup{} ]] local function require_all_configs() + -- Make sure username doesn't leak into the generated document + local old_home = vim.env.HOME + local old_cache_home = vim.env.XDG_CACHE_HOME + vim.env.HOME = '/home/user' + vim.env.XDG_CACHE_HOME = '/home/user/.cache' + -- Configs are lazy-loaded, tickle them to populate the `configs` singleton. for _, v in ipairs(vim.fn.glob('lua/lspconfig/server_configurations/*.lua', 1, 1)) do local module_name = v:gsub('.*/', ''):gsub('%.lua$', '') configs[module_name] = require('lspconfig.server_configurations.' .. module_name) end + + -- Reset the environment variables + vim.env.HOME = old_home + vim.env.XDG_CACHE_HOME = old_cache_home end local function make_lsp_sections() -- cgit v1.2.3-70-g09d2