~mapperr/trl

815549e1e82487de2aa829c967628644b5cc8035 — mapperr 2 years ago 1a976c6
Add showing only board's list
3 files changed, 28 insertions(+), 4 deletions(-)

M README.md
M trullo.py
M trullo/printer.py
M README.md => README.md +5 -2
@@ 30,8 30,11 @@ Here is the usage (check `trl -h` too):
        with board_shortcut you can select the board you want to work with

    trl l [<list_shortcut>]
        shows the board you have currently selected
        with list_shortcut you can show a single list
        shows lists and cards in the board you have currently selected
        with list_shortcut you can show cards a single list

    trl ll
        shows only the board's lists

    trl c <card_shortcut> [o | m <list_shortcut> | e]
        shows the card infos

M trullo.py => trullo.py +10 -2
@@ 3,6 3,7 @@
usage:
    trl b [<board_shortcut>]
    trl l [<list_shortcut>]
    trl ll
    trl c <card_shortcut> [o | m <list_shortcut> | e | n <list_shortcut>]
    trl c n <list_shortcut>
    trl g <api_path>


@@ 17,8 18,11 @@ commands:
        with board_shortcut you can select the board you want to work with

    l [<list_shortcut>]
        shows the board you have currently selected
        with list_shortcut you can show a single list
        shows lists and cards in the board you have currently selected
        with list_shortcut you can show cards a single list

    ll
        shows only the board's lists

    c <card_shortcut> [o | m <list_shortcut> | e]
        shows the card infos


@@ 117,6 121,10 @@ if __name__ == '__main__':
        print(f'first select a board with `trl b`')
        exit(1)

    if args['ll']:
        board = tclient.get_board(selected_board_id)
        Printer.print_board_lists(board)

    if args['l']:
        board = tclient.get_board(selected_board_id)
        list_shortcut = args['<list_shortcut>']

M trullo/printer.py => trullo/printer.py +13 -0
@@ 35,6 35,19 @@ class Printer:
        print()

    @staticmethod
    def print_board_lists(board: TrlBoard):
        symbol_count_lists = Shortener.get_min_symbols_to_uniq([list_.id for list_ in board.lists], True)
        print(f"{board.raw_data['shortUrl']}")
        print('------------------------------')
        print(f"{board.raw_data['name']}")
        print()
        if board.lists is not None:
            for list_ in board.lists:
                print(
                    f"[{list_.id[len(list_.id) - symbol_count_lists:len(list_.id)].lower()}] {list_.raw_data['name']}")
        print()

    @staticmethod
    def print_card(card: TrlCard):
        d = card.raw_data
        formatted_desc = '\t' + str(d['desc']).replace('\n', '\n\t')