From 1e3d59fee27175388a6c290af5d66b3fd96e46d0 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Wed, 8 Mar 2023 13:22:06 +0100 Subject: [PATCH] Don't prompt for toot text if media is given This allows you to post an image without text: toot post --media image.png And not get prompted to write some text, which seems desirable. --- toot/commands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toot/commands.py b/toot/commands.py index 18e7be6..2656bfc 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -87,7 +87,7 @@ def post(app, user, args): raise ConsoleError("Cannot attach more than 4 files.") media_ids = _upload_media(app, user, args) - status_text = _get_status_text(args.text, args.editor) + status_text = _get_status_text(args.text, args.editor, args.media) scheduled_at = _get_scheduled_at(args.scheduled_at, args.scheduled_in) if not status_text and not media_ids: @@ -115,7 +115,7 @@ def post(app, user, args): delete_tmp_status_file() -def _get_status_text(text, editor): +def _get_status_text(text, editor, media): isatty = sys.stdin.isatty() if not text and not isatty: @@ -124,7 +124,7 @@ def _get_status_text(text, editor): if isatty: if editor: text = editor_input(editor, text) - elif not text: + elif not text and not media: print_out("Write or paste your toot. Press {} to post it.".format(EOF_KEY)) text = multiline_input()