~mapperr/trl

f0199cf618af7c4bcc3737e98948d2f7ceeb02e6 — mapperr 3 years ago dad784a
Add labels to board view
4 files changed, 39 insertions(+), 17 deletions(-)

M README.md
M trullo.py
M trullo/printer.py
M trullo/usecases.py
M README.md => README.md +15 -8
@@ 5,11 5,11 @@ A dumb trello cli with shortcuts.

## Setup

Get the repo and run `pipenv install` in it
Get the repo and run `pipenv install` in it.

You don't have pipenv installed? Shame on you.\
([Here](https://pipenv.readthedocs.io/en/latest/install/#pragmatic-installation-of-pipenv)
is how to can get it, but usually is a `pip install --user pipenv`)
is how you can get it, but usually is a `pip install --user pipenv`)

Yeah, I know you want a binary, I will package this thing, bear it for now.



@@ 20,6 20,10 @@ Authenticate yourself by putting these variables in you environment:

Go get them on [trello](https://trello.com/app-key)!

Now link the `trl` script in your `PATH`.
It's a bash script that wraps the underneath python call.
Feel free to hack it or use something else.

Aaaand, that's it, you are good to go.




@@ 54,14 58,13 @@ Here is the usage (check `trl -h` too):

## Shortcuts

Shortcuts are derived from boards and cards short urls and from lists ids
(lists does not have short urls) and are as short as possible.

So to move a card to a list you get something like this:
Shortcuts are derived from boards and cards names and short urls
and from lists names and ids (lists does not have short urls).

    trl c j0 m e
So to move the card *Architecture design* to the list *Done*
you get something like this:

`j0` is the card shortcut and `e` is the list shortcut
    trl c arch m done

Oh, everything is kept lowercase, holding shift is a pain in the ass.



@@ 71,3 74,7 @@ Oh, everything is kept lowercase, holding shift is a pain in the ass.
I know, It's nothing fancy, I just started it to check some trello stuff
directly in the terminal, and eventually edit them.


### Development board

- https://trello.com/b/fuK3ff2z

M trullo.py => trullo.py +16 -7
@@ 1,6 1,7 @@
"""Trullo

usage:
    trl o
    trl b [<board_shortcut>]
    trl l [<list_shortcuts>...]
    trl ll


@@ 13,6 14,9 @@ usage:


commands:
    o
        open trello in your browser

    b [<board_shortcut>]
        shows the boards you can access
        with board_shortcut you can select the board you want to work with


@@ 44,6 48,9 @@ env:

    you can obtain those values here: https://trello.com/app-key


trello development board: https://trello.com/b/fuK3ff2z

"""
import logging
import pprint


@@ 55,7 62,6 @@ from trullo.printer import Printer
from trullo.shortener import Shortener
from trullo.tclient import TClient
from trullo.tconfig import TConfig
# logging.basicConfig(level=logging.DEBUG)
from trullo.usecases import Usecases

logging.basicConfig(level=logging.INFO)


@@ 83,26 89,29 @@ if __name__ == '__main__':
        pp = pprint.PrettyPrinter(indent=4)
        pp.pprint(tclient.get(api_path))

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

    elif args['b']:
        if args['<board_shortcut>']:
            board_shortcut = args['<board_shortcut>']
            usecases.select_board(board_shortcut)
        else:
            usecases.print_board_list()

    # stuff that works only if a board is selected
    if not args['b'] and selected_board_name is None:
    # 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`')
        exit(1)

    if args['ll']:
    elif args['ll']:
        usecases.print_board_lists()

    if args['l']:
    elif args['l']:
        list_shortcuts = args['<list_shortcuts>']
        usecases.print_lists(list_shortcuts)

    if args['c']:
    elif args['c']:
        new_command = args['n']
        if new_command:
            target_list_shortcut = args['<list_shortcut>']

M trullo/printer.py => trullo/printer.py +5 -2
@@ 36,8 36,11 @@ class Printer:
                      f"[{list_.raw_data['id'].lower()}]")
                for card in board.cards:
                    if card.raw_data['idList'] == list_.id:
                        print(f"\t[{card.raw_data['shortLink'].lower()}] "
                              f"{card.raw_data['name']}")
                        card_output = f"\t[{card.raw_data['shortLink'].lower()}] "
                        for raw_label in card.raw_data['labels']:
                            card_output += f'({raw_label["name"]}) '
                        card_output += f"{card.raw_data['name']}"
                        print(card_output)
        print()

    @staticmethod

M trullo/usecases.py => trullo/usecases.py +3 -0
@@ 34,6 34,9 @@ class Usecases:
                return selected_board_id, selected_board_name
        return None, None

    def open_trello_in_browser(self):
        subprocess.Popen(['xdg-open', 'https://trello.com'])

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