1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-06-23 06:25:26 +00:00

Simplify account timeline options

This commit is contained in:
Ivan Habunek 2023-06-22 11:16:32 +02:00
parent f7ba208d3b
commit 51d60679c3
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
2 changed files with 6 additions and 12 deletions

View File

@ -15,9 +15,8 @@ from toot.utils import args_get_instance, delete_tmp_status_file, editor_input,
def get_timeline_generator(app, user, args): def get_timeline_generator(app, user, args):
# Make sure tag, list and public are not used simultaneously if len([arg for arg in [args.tag, args.list, args.public, args.account] if arg]) > 1:
if len([arg for arg in [args.tag, args.list, args.public, args.account_tl] if arg]) > 1: raise ConsoleError("Only one of --public, --tag, --account, or --list can be used at one time.")
raise ConsoleError("Only one of --public, --tag, --account_tl, or --list can be used at one time.")
if args.local and not (args.public or args.tag): if args.local and not (args.public or args.tag):
raise ConsoleError("The --local option is only valid alongside --public or --tag.") raise ConsoleError("The --local option is only valid alongside --public or --tag.")
@ -35,7 +34,7 @@ def get_timeline_generator(app, user, args):
return api.anon_tag_timeline_generator(args.instance, args.tag, limit=args.count) return api.anon_tag_timeline_generator(args.instance, args.tag, limit=args.count)
else: else:
return api.tag_timeline_generator(app, user, args.tag, local=args.local, limit=args.count) return api.tag_timeline_generator(app, user, args.tag, local=args.local, limit=args.count)
elif args.account_tl: elif args.account:
return api.account_timeline_generator(app, user, args.account, limit=args.count) return api.account_timeline_generator(app, user, args.account, limit=args.count)
elif args.list: elif args.list:
return api.timeline_list_generator(app, user, args.list, limit=args.count) return api.timeline_list_generator(app, user, args.list, limit=args.count)

View File

@ -238,10 +238,9 @@ common_timeline_args = [
"type": str, "type": str,
"help": "show hashtag timeline (does not require auth)", "help": "show hashtag timeline (does not require auth)",
}), }),
(["-at", "--account_tl"], { (["-a", "--account"], {
"action": "store_true", "type": str,
"default": False, "help": "show timeline for the given account",
"help": "show account timeline (requires account name)",
}), }),
(["-l", "--local"], { (["-l", "--local"], {
"action": "store_true", "action": "store_true",
@ -256,10 +255,6 @@ common_timeline_args = [
"type": str, "type": str,
"help": "show timeline for given list.", "help": "show timeline for given list.",
}), }),
(["account"], {
"nargs": "?",
"help": "account name, e.g. 'Gargron@mastodon.social'",
}),
] ]
timeline_and_bookmark_args = [ timeline_and_bookmark_args = [