Add support for timeline tag command - toot - Unnamed repository; edit this file 'description' to name the repository.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 3bc2e74b8855375001ed48dc2d4866db71232608
(DIR) parent a18df271fef4d221601d1b5e707010f06bba2c79
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
Date: Wed, 31 Jan 2018 15:23:24 +0100
Add support for timeline tag command
This allows displaying the timeline for tags.
Diffstat:
toot/api.py | 8 ++++++--
toot/commands.py | 2 +-
toot/console.py | 7 ++++++-
3 files changed, 13 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/toot/api.py b/toot/api.py
@@ -84,8 +84,12 @@ def post_status(app, user, status, visibility='public', media_ids=None):
}).json()
-def timeline_home(app, user):
- return http.get(app, user, '/api/v1/timelines/home').json()
+def timeline_home(app, user, args):
+ if args.tag:
+ timeline = "tag/%s" % args.tag
+ else:
+ timeline = "home"
+ return http.get(app, user, '/api/v1/timelines/%s' % timeline).json()
def get_next_path(headers):
(DIR) diff --git a/toot/commands.py b/toot/commands.py
@@ -54,7 +54,7 @@ def _parse_timeline(item):
def timeline(app, user, args):
- items = api.timeline_home(app, user)
+ items = api.timeline_home(app, user, args)
parsed_items = [_parse_timeline(t) for t in items]
print_out("─" * 31 + "┬" + "─" * 88)
(DIR) diff --git a/toot/console.py b/toot/console.py
@@ -132,7 +132,12 @@ READ_COMMANDS = [
Command(
name="timeline",
description="Show recent items in your public timeline",
- arguments=[],
+ arguments=[
+ (["tag"], {
+ "help" : "Search for a tag",
+ "nargs" : "?",
+ }),
+ ],
require_auth=True,
),
Command(