예제 #1
0
def timeline(app, user, args):
    items = api.timeline_home(app, user)
    parsed_items = [_parse_timeline(t) for t in items]

    print_out("─" * 31 + "┬" + "─" * 88)
    for item in parsed_items:
        _print_timeline(item)
        print_out("─" * 31 + "┼" + "─" * 88)
예제 #2
0
def cmd_timeline(app, user, args):
    parser = ArgumentParser(prog="toot timeline",
                            description="Show recent items in your public timeline",
                            epilog="https://github.com/ihabunek/toot")

    args = parser.parse_args(args)

    items = api.timeline_home(app, user)
    parsed_items = [parse_timeline(t) for t in items]

    print("─" * 31 + "┬" + "─" * 88)
    for item in parsed_items:
        print_timeline(item)
        print("─" * 31 + "┼" + "─" * 88)
예제 #3
0
파일: commands.py 프로젝트: mugcake/toot
def timeline(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] if arg]) > 1:
        raise ConsoleError(
            "Only one of --public, --tag, or --list can be used at one time.")

    if args.local and not (args.public or args.tag):
        raise ConsoleError(
            "The --local option is only valid alongside --public or --tag.")

    if args.public:
        items = api.timeline_public(app, user, local=args.local)
    elif args.tag:
        items = api.timeline_tag(app, user, args.tag, local=args.local)
    elif args.list:
        items = api.timeline_list(app, user, args.list)
    else:
        items = api.timeline_home(app, user)

    if args.reverse:
        items = reversed(items)

    print_timeline(items)