Example #1
0
def show_tags(config, json):
    '''Display all tags on this board'''
    _, board, _ = BoardTool.start(config)
    display = Display(config.color)
    if config.banner and not json:
        display.banner()
    tag_names = [t.name for t in board.get_labels()]
    display.show_raw(tag_names, use_json=json)
Example #2
0
def show_tags(config, json):
    '''Display all tags on this board'''
    _, board = BoardTool.start(config)
    display = Display(config.color)
    if config.banner and not json:
        display.banner()
    tag_names = [t.name for t in board.get_labels()]
    display.show_raw(tag_names, use_json=json)
Example #3
0
def show_lists(config, json, show_all):
    '''Display all lists on this board'''
    _, board, _ = BoardTool.start(config)
    display = Display(config.color)
    if config.banner and not json:
        display.banner()
    list_filter = 'all' if show_all else 'open'
    list_names = [l.name for l in board.get_lists(list_filter)]
    display.show_raw(list_names, use_json=json)
Example #4
0
def show_lists(config, json, show_all):
    '''Display all lists on this board'''
    _, board = BoardTool.start(config)
    display = Display(config.color)
    if config.banner and not json:
        display.banner()
    list_filter = 'all' if show_all else 'open'
    list_names = [l.name for l in board.get_lists(list_filter)]
    display.show_raw(list_names, use_json=json)
Example #5
0
def show_boards(config, json, tsv, by, show_all):
    '''Show all boards your account can access'''
    connection, board = BoardTool.start(config)
    display = Display(config.color)
    if config.banner and not json:
        display.banner()
    if show_all:
        boards = connection.trello.fetch_json('/members/me/boards/?filter=all')
    else:
        boards = connection.boards
    if json:
        display.show_raw(boards, use_json=json)
        return
    # Set up a table to hold our boards
    board_columns = ['name', 'activity', 'members', 'permission', 'url']
    if by not in board_columns:
        click.secho('Field {} is not a valid field: {}'.format(
            by, ','.join(board_columns)),
                    fg='red')
        raise GTDException(1)
    table = prettytable.PrettyTable()
    table.field_names = board_columns
    table.align = 'l'
    if tsv:
        table.set_style(prettytable.PLAIN_COLUMNS)
    else:
        table.hrules = prettytable.FRAME
    for b in boards:
        table.add_row([
            b['name'],
            b['dateLastActivity'] or '',
            len(b['memberships']),
            b['prefs']['permissionLevel'],
            b['shortUrl'],
        ])
    try:
        table[0]
    except IndexError:
        click.secho('You have no boards!', fg='red')
    print(table.get_string(sortby=by))