From 12f41f30b3ddf7d0f2915400dc19558f8c45b280 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 3 Feb 2022 20:43:23 +0530 Subject: [PATCH] Only show important env vars in debug output Also show their values since these are not sensitive --- kitty/debug_config.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kitty/debug_config.py b/kitty/debug_config.py index 0457454b2..e5bc7bfa3 100644 --- a/kitty/debug_config.py +++ b/kitty/debug_config.py @@ -215,6 +215,16 @@ def debug_config(opts: KittyOpts) -> str: p(' ', '\n '.join(opts.config_overrides)) compare_opts(opts, p) p() - p(green('Environment variable names seen by the kitty process:')) - p('\t' + '\n\t'.join(sorted(os.environ))) + p(green('Important environment variables seen by the kitty process:')) + + def penv(k: str) -> None: + v = os.environ.get(k) + if v is not None: + p('\t' + k.ljust(35), styled(v, dim=True)) + + for k in 'PATH LANG KITTY_CONFIG_DIRECTORY KITTY_CACHE_DIRECTORY VISUAL EDITOR GLFW_IM_MODULE KITTY_WAYLAND_DETECT_MODIFIERS'.split(): + penv(k) + for k in os.environ: + if k.startswith('LC_'): + penv(k) return out.getvalue()