"toot list" console command added
This commit is contained in:
parent
6bcd43a6ae
commit
855b2a1526
4 changed files with 29 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
|||
|
||||
import sys
|
||||
import platform
|
||||
|
||||
|
@ -8,7 +9,7 @@ from toot.auth import login_interactive, login_browser_interactive, create_app_i
|
|||
from toot.exceptions import ApiError, ConsoleError
|
||||
from toot.output import (print_out, print_instance, print_account, print_acct_list,
|
||||
print_search_results, print_timeline, print_notifications,
|
||||
print_tag_list)
|
||||
print_tag_list, print_list_list)
|
||||
from toot.tui.utils import parse_datetime
|
||||
from toot.utils import args_get_instance, delete_tmp_status_file, editor_input, multiline_input, EOF_KEY
|
||||
|
||||
|
@ -423,6 +424,11 @@ def tags_followed(app, user, args):
|
|||
print_tag_list(response)
|
||||
|
||||
|
||||
def lists(app, user, args):
|
||||
response = api.get_lists(app, user)
|
||||
print_list_list(response)
|
||||
|
||||
|
||||
def mute(app, user, args):
|
||||
account = find_account(app, user, args.account)
|
||||
api.mute(app, user, account['id'])
|
||||
|
|
|
@ -724,6 +724,14 @@ TAG_COMMANDS = [
|
|||
),
|
||||
]
|
||||
|
||||
LIST_COMMANDS = [
|
||||
Command(
|
||||
name="lists",
|
||||
description="List all user lists",
|
||||
arguments=[],
|
||||
require_auth=True,
|
||||
),
|
||||
]
|
||||
COMMAND_GROUPS = [
|
||||
("Authentication", AUTH_COMMANDS),
|
||||
("TUI", TUI_COMMANDS),
|
||||
|
@ -732,6 +740,7 @@ COMMAND_GROUPS = [
|
|||
("Status", STATUS_COMMANDS),
|
||||
("Accounts", ACCOUNTS_COMMANDS),
|
||||
("Hashtags", TAG_COMMANDS),
|
||||
("Lists", LIST_COMMANDS),
|
||||
]
|
||||
|
||||
COMMANDS = list(chain(*[commands for _, commands in COMMAND_GROUPS]))
|
||||
|
|
|
@ -210,6 +210,17 @@ def print_tag_list(tags):
|
|||
print_out("You're not following any hashtags.")
|
||||
|
||||
|
||||
def print_list_list(lists):
|
||||
if lists:
|
||||
for list_item in lists:
|
||||
replies_policy = list_item['replies_policy'] if list_item['replies_policy'] else ''
|
||||
print_out(f"Name: <green>\"{list_item['title']}\"</green>\t"
|
||||
+ f"ID: <green>{list_item['id']}\t</green>"
|
||||
+ f"Replies policy: <green>{replies_policy}</green>")
|
||||
else:
|
||||
print_out("You have no lists defined.")
|
||||
|
||||
|
||||
def print_search_results(results):
|
||||
accounts = results['accounts']
|
||||
hashtags = results['hashtags']
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# scroll.py
|
||||
#
|
||||
# Copied from the stig project by rndusr@github
|
||||
# https://github.com/rndusr/stig
|
||||
# https://github.com/rndusr/sti
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
Loading…
Reference in a new issue