~mapperr/trl

2f3f73d4837184bb473695b6fb7e11f86554f404 — mapperr 1 year, 11 months ago cbed7f6
Open selected board in browser
2 files changed, 14 insertions(+), 4 deletions(-)

M trullo.py
M trullo/usecases.py
M trullo.py => trullo.py +9 -4
@@ 16,7 16,8 @@ usage:

commands:
    o
        open trello in your browser
        opens trello home in your browser
        or it opens the currently selected board in browser

    b [<board_shortcut>]
        shows the boards you can access


@@ 105,9 106,6 @@ if __name__ == '__main__':
            else:
                usecases.print_card(card_shortcut)

    elif args['o']:
        usecases.open_trello_in_browser()

    elif args['b']:
        if args['<board_shortcut>']:
            board_shortcut = args['<board_shortcut>']


@@ 115,6 113,13 @@ if __name__ == '__main__':
        else:
            usecases.print_board_list()

    elif args['o']:
        board_id, board_name = usecases.get_selected_board()
        if board_id is None:
            usecases.open_trello_in_browser()
        else:
            usecases.open_selected_board_in_browser()

    # below are stuffs that works only if a board is selected
    elif not args['b'] and selected_board_name is None:
        print(f'first select a board with `trl b`')

M trullo/usecases.py => trullo/usecases.py +5 -0
@@ 37,6 37,11 @@ class Usecases:
    def open_trello_in_browser(self):
        subprocess.Popen(['xdg-open', 'https://trello.com'])

    def open_selected_board_in_browser(self):
        board = self.tclient.get_board(self.selected_board_id)
        board_url = board.raw_data['shortUrl']
        subprocess.Popen(['xdg-open', board_url])

    def print_board_list(self):
        boards = self.tclient.get_boards()
        self.printer.print_boards(boards)