mirror of
https://github.com/ihabunek/toot
synced 2024-12-22 15:06:05 +01:00
Make toot diag work when not logged in
This commit is contained in:
parent
9c1a845498
commit
a0e0f4fccd
@ -1,11 +1,9 @@
|
||||
from typing import Optional
|
||||
import click
|
||||
from toot import api
|
||||
from toot import api, config
|
||||
from toot.entities import Data
|
||||
from toot.output import print_diags
|
||||
from toot.cli import (
|
||||
cli,
|
||||
pass_context,
|
||||
Context,
|
||||
)
|
||||
from toot.cli import cli
|
||||
|
||||
|
||||
@cli.command()
|
||||
@ -21,9 +19,12 @@ from toot.cli import (
|
||||
is_flag=True,
|
||||
help="Print information about the curren server in diagnostic output",
|
||||
)
|
||||
@pass_context
|
||||
def diag(ctx: Context, files: bool, server: bool):
|
||||
def diag(files: bool, server: bool):
|
||||
"""Display useful information for diagnosing problems"""
|
||||
instance_dict: Optional[Data] = None
|
||||
if server:
|
||||
_, app = config.get_active_user_app()
|
||||
if app:
|
||||
instance_dict = api.get_instance(app.base_url).json()
|
||||
|
||||
instance_dict = api.get_instance(ctx.app.base_url).json() if server else None
|
||||
print_diags(instance_dict, files)
|
||||
|
@ -4,7 +4,7 @@ import shutil
|
||||
import textwrap
|
||||
import typing as t
|
||||
|
||||
from toot.entities import Account, Instance, Notification, Poll, Status, List
|
||||
from toot.entities import Account, Data, Instance, Notification, Poll, Status, List
|
||||
from toot.utils import get_text, html_to_paragraphs
|
||||
from toot.wcstring import wc_wrap
|
||||
from wcwidth import wcswidth
|
||||
@ -314,7 +314,7 @@ def format_account_name(account: Account) -> str:
|
||||
return acct
|
||||
|
||||
|
||||
def print_diags(instance_dict: t.Dict, include_files: bool):
|
||||
def print_diags(instance_dict: t.Optional[Data], include_files: bool):
|
||||
from importlib.metadata import version
|
||||
|
||||
click.echo(f'{green(f"Diagnostic Information")}')
|
||||
|
Loading…
Reference in New Issue
Block a user