2024-08-12 08:57:59 +02:00
|
|
|
from typing import Optional
|
2024-06-18 23:18:36 +02:00
|
|
|
import click
|
2024-08-12 08:57:59 +02:00
|
|
|
from toot import api, config
|
|
|
|
from toot.entities import Data
|
2024-06-14 02:27:31 +02:00
|
|
|
from toot.output import print_diags
|
2024-08-12 08:57:59 +02:00
|
|
|
from toot.cli import cli
|
2024-06-14 02:27:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
@cli.command()
|
2024-06-18 23:18:36 +02:00
|
|
|
@click.option(
|
|
|
|
"-f",
|
|
|
|
"--files",
|
|
|
|
is_flag=True,
|
|
|
|
help="Print contents of the config and settings files in diagnostic output",
|
|
|
|
)
|
2024-08-05 05:37:40 +02:00
|
|
|
@click.option(
|
|
|
|
"-s",
|
|
|
|
"--server",
|
|
|
|
is_flag=True,
|
|
|
|
help="Print information about the curren server in diagnostic output",
|
|
|
|
)
|
2024-08-12 08:57:59 +02:00
|
|
|
def diag(files: bool, server: bool):
|
2024-06-14 02:27:31 +02:00
|
|
|
"""Display useful information for diagnosing problems"""
|
2024-08-12 08:57:59 +02:00
|
|
|
instance_dict: Optional[Data] = None
|
|
|
|
if server:
|
|
|
|
_, app = config.get_active_user_app()
|
|
|
|
if app:
|
|
|
|
instance_dict = api.get_instance(app.base_url).json()
|
2024-06-14 02:27:31 +02:00
|
|
|
|
2024-08-05 05:37:40 +02:00
|
|
|
print_diags(instance_dict, files)
|