2024-06-18 23:18:36 +02:00
|
|
|
import click
|
2024-08-05 05:37:40 +02:00
|
|
|
from toot import api
|
2024-06-14 02:27:31 +02:00
|
|
|
from toot.output import print_diags
|
|
|
|
from toot.cli import (
|
|
|
|
cli,
|
|
|
|
pass_context,
|
|
|
|
Context,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@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-06-14 02:27:31 +02:00
|
|
|
@pass_context
|
2024-08-05 05:37:40 +02:00
|
|
|
def diag(ctx: Context, files: bool, server: bool):
|
2024-06-14 02:27:31 +02:00
|
|
|
"""Display useful information for diagnosing problems"""
|
|
|
|
|
2024-08-05 05:37:40 +02:00
|
|
|
instance_dict = api.get_instance(ctx.app.base_url).json() if server else None
|
|
|
|
print_diags(instance_dict, files)
|