1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-06-30 06:35:24 +00:00

Added config and settings file output to toot diag

This commit is contained in:
Daniel Schwarz 2024-06-18 17:18:36 -04:00
parent ded6ec98bc
commit df98705627

View File

@ -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()}')