Only show important env vars in debug output

Also show their values since these are not sensitive
This commit is contained in:
Kovid Goyal 2022-02-03 20:43:23 +05:30
parent 1e7edd0218
commit 12f41f30b3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -215,6 +215,16 @@ def debug_config(opts: KittyOpts) -> str:
p(' ', '\n '.join(opts.config_overrides)) p(' ', '\n '.join(opts.config_overrides))
compare_opts(opts, p) compare_opts(opts, p)
p() p()
p(green('Environment variable names seen by the kitty process:')) p(green('Important environment variables seen by the kitty process:'))
p('\t' + '\n\t'.join(sorted(os.environ)))
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() return out.getvalue()