From eeb90dc21cff03749d3becff680ee73558cd3440 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Tue, 26 Dec 2023 10:35:41 +0100 Subject: [PATCH] Remove --quiet flag --- CHANGELOG.md | 7 ++++--- changelog.yaml | 3 ++- docs/changelog.md | 7 ++++--- toot/cli/__init__.py | 9 +++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b260e9..57f379d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Changelog -**0.40.0 (TBA)** +**0.40.0 (SOON)** This release includes a rather extensive change to use the Click library (https://click.palletsprojects.com/) for creating the command line interface. @@ -13,8 +13,9 @@ mostly preserved, except for cases noted below. Please report any issues. * BREAKING: Remove deprecated `--disable-https` option for `login` and `login_cli`, pass the base URL instead -* BREAKING: Options `--debug`, `--color`, `--quiet` must be specified after - `toot` but before the command +* BREAKING: Options `--debug` and `--color` must be specified after `toot` but + before the command +* BREAKING: Option `--quiet` has been removed. Redirect output instead. * Add passing parameters via environment variables, see: https://toot.bezdomni.net/environment_variables.html * Add shell completion, see: https://toot.bezdomni.net/shell_completion.html diff --git a/changelog.yaml b/changelog.yaml index 0cc21a4..b775c44 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -9,7 +9,8 @@ Please report any issues. changes: - "BREAKING: Remove deprecated `--disable-https` option for `login` and `login_cli`, pass the base URL instead" - - "BREAKING: Options `--debug`, `--color`, `--quiet` must be specified after `toot` but before the command" + - "BREAKING: Options `--debug` and `--color` must be specified after `toot` but before the command" + - "BREAKING: Option `--quiet` has been removed. Redirect output instead." - "Add passing parameters via environment variables, see: https://toot.bezdomni.net/environment_variables.html" - "Add shell completion, see: https://toot.bezdomni.net/shell_completion.html" - "Add `tags info`, `tags featured`, `tags feature`, and `tags unfeature` commands" diff --git a/docs/changelog.md b/docs/changelog.md index 5b260e9..57f379d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,7 +3,7 @@ Changelog -**0.40.0 (TBA)** +**0.40.0 (SOON)** This release includes a rather extensive change to use the Click library (https://click.palletsprojects.com/) for creating the command line interface. @@ -13,8 +13,9 @@ mostly preserved, except for cases noted below. Please report any issues. * BREAKING: Remove deprecated `--disable-https` option for `login` and `login_cli`, pass the base URL instead -* BREAKING: Options `--debug`, `--color`, `--quiet` must be specified after - `toot` but before the command +* BREAKING: Options `--debug` and `--color` must be specified after `toot` but + before the command +* BREAKING: Option `--quiet` has been removed. Redirect output instead. * Add passing parameters via environment variables, see: https://toot.bezdomni.net/environment_variables.html * Add shell completion, see: https://toot.bezdomni.net/shell_completion.html diff --git a/toot/cli/__init__.py b/toot/cli/__init__.py index d57a722..8e44af0 100644 --- a/toot/cli/__init__.py +++ b/toot/cli/__init__.py @@ -78,14 +78,12 @@ class Context(t.NamedTuple): user: t.Optional[User] = None color: bool = False debug: bool = False - quiet: bool = False class TootObj(t.NamedTuple): """Data to add to Click context""" color: bool = True debug: bool = False - quiet: bool = False # Pass a context for testing purposes test_ctx: t.Optional[Context] = None @@ -111,7 +109,7 @@ def get_context() -> Context: if not user or not app: raise click.ClickException("This command requires you to be logged in.") - return Context(app, user, obj.color, obj.debug, obj.quiet) + return Context(app, user, obj.color, obj.debug) json_option = click.option( @@ -126,12 +124,11 @@ json_option = click.option( @click.option("-w", "--max-width", type=int, default=80, help="Maximum width for content rendered by toot") @click.option("--debug/--no-debug", default=False, help="Log debug info to stderr") @click.option("--color/--no-color", default=sys.stdout.isatty(), help="Use ANSI color in output") -@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: click.Context, max_width: int, color: bool, debug: bool, quiet: bool): +def cli(ctx: click.Context, max_width: int, color: bool, debug: bool): """Toot is a Mastodon CLI""" - ctx.obj = TootObj(color, debug, quiet) + ctx.obj = TootObj(color, debug) ctx.color = color ctx.max_content_width = max_width