mirror of
https://github.com/ihabunek/toot
synced 2024-12-22 07:01:46 +01:00
Simplify account timeline options
This commit is contained in:
parent
f7ba208d3b
commit
51d60679c3
@ -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)
|
||||||
|
@ -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 = [
|
||||||
|
Loading…
Reference in New Issue
Block a user