Respect --no-color

This commit is contained in:
Ivan Habunek 2023-12-05 09:59:40 +01:00
parent a653b557b4
commit b539c933ef
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
1 changed files with 9 additions and 1 deletions

View File

@ -78,10 +78,18 @@ json_option = click.option(
@click.option("--quiet/--no-quiet", default=False, help="Don't print anything to stdout")
@click.version_option(__version__, message="%(prog)s v%(version)s")
@click.pass_context
def cli(ctx, color, debug, quiet, app=None, user=None):
def cli(
ctx: click.Context,
color: bool,
debug: bool,
quiet: bool,
app: t.Optional[App] = None,
user: t.Optional[User] = None,
):
"""Toot is a Mastodon CLI"""
user, app = config.get_active_user_app()
ctx.obj = Context(app, user, color, debug, quiet)
ctx.color = color
if debug:
logging.basicConfig(level=logging.DEBUG)