From df987056279ba5794bc5f72f2c954e78a1c3a362 Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Tue, 18 Jun 2024 17:18:36 -0400 Subject: [PATCH] Added config and settings file output to toot diag --- toot/output.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/toot/output.py b/toot/output.py index 6c352c1..de174a5 100644 --- a/toot/output.py +++ b/toot/output.py @@ -325,7 +325,31 @@ def print_diags(): from toot import __version__, config, settings click.echo(f'{green(f"Toot version:")} {__version__}') - + + click.echo(f'{green(f"Settings path:")} {settings.get_settings_path()}') + click.echo(f'{green(f"Settings file contents:")}') + try: + with open(settings.get_settings_path(), 'r') as f: + print(f.read()) + except: # noqa + click.echo(f'{yellow(f"Could not open settings file")}') + + click.echo('') + + click.echo(f'{green(f"Config path:")} {config.get_config_file_path()}') + click.echo(f'{green(f"Config file contents:")}') + try: + with open(config.get_config_file_path(), 'r') as f: + for line in f: + if "client_" not in line and "token" not in line: + click.echo(line, nl=False) + else: + click.echo(f'{yellow("***LINE REDACTED***")}') + except: # noqa + click.echo(f'{yellow(f"Could not open config file")}') + + click.echo('') + import platform click.echo(f'{green(f"Platform:")} {platform.platform()}')