Skip to content

Commit

Permalink
Prevent toot timeline to break when piped to extenal programs
Browse files Browse the repository at this point in the history
Toot timeline try to ask the user to continue in the next page. This
doesn't works if the command is piped to any other software.

We stop the query in the first loop when not in a tty context. The
command should be called with the expected item count in this case.
  • Loading branch information
stacyharper authored and ihabunek committed Aug 28, 2021
1 parent 2c42078 commit 6115cea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
changes:
- "Add `--scheduled-at` option to `toot post`, allows scheduling toots"
- "Add `--description` option to `toot post`, for adding descriptions to media attachments (thanks @ansuz)"
- "Disable paging timeline when output is piped (thanks @stacyharper)"

0.27.0:
date: 2020-06-15
Expand Down
2 changes: 1 addition & 1 deletion toot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def timeline(app, user, args):

print_timeline(items)

if args.once:
if args.once or not sys.stdout.isatty():
break

char = input("\nContinue? [Y/n] ")
Expand Down

0 comments on commit 6115cea

Please sign in to comment.