Skip to content

dxvsh/trello-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trello CLI

trello-cli is a simple CLI tool for managing your Trello cards. It allows you to search, create and update your cards directly from your terminal without needing to access the Trello web interface.


Contents

Features

  • Card Search: Search for cards across all your boards
  • Create Cards: Add new cards to any list with labels and comments
  • Update Cards: Update existing cards, including their names, lists, comments and archival state
  • Board Discovery: View all your Trello boards with their IDs
  • List Discovery: View all lists within a board and cards within those lists
  • Label Discovery: View all available labels in a board
  • Environment Variable Support: Configure your Trello credentials via environment variables or command-line options
  • Rich Terminal Output: Beautifully formatted output for better readability using rich
  • Command Help System: Each subcommand has detailed help information available via the --help flag

Installation

  1. Change to the trello-cli directory:
cd trello-cli
  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate
  1. Install the package:
pip install .

To install the package in editable mode, use the -e option:

pip install -e .

Configuration

You can provide your Trello API credentials in two ways:

  • Using Environment Variables:

Create the following environment variables (by adding them to your .bashrc/.zshrc or other appropriate file):

export TRELLO_API_KEY=your_api_key
export TRELLO_TOKEN=your_token
  • Command-Line Options:

You can also provide credentials with each command using --api-key and --token options

Usage

The CLI provides several commands to help you manage your Trello boards and cards. Each command has detailed help information available via the --help flag. Its really helpful in telling you what options are available and how to use them.

  • View All Commands and General Help
trello-cli --help
  • List Your Boards
trello-cli boards
trello-cli boards --help # for more information
  • View Lists in a Board
trello-cli lists --board-id <board_id>
trello-cli lists -b <board_id> # short form
trello-cli lists --help # for more information
  • View Cards in a List
trello-cli view-cards --list-id <list_id>
trello-cli view-cards -l <list_id> # short form
  • View Labels in a Board
trello-cli labels --board-id <board_id>
trello-cli labels -b <board_id> # short form
trello-cli labels --help # for more information
  • Search for Cards using a query string
trello-cli search --query <search_term>
trello-cli search --help # for more information
  • Create a new Card
trello-cli add-card --list-id <list_id> --name "Card Name"
trello-cli add-card --help  # for more information
  • Create a new Card with Labels and Comment
trello-cli add-card --list-id <list_id> --name "Card Name" --label <label_id_1>,<label_id_2> --comment "Card Comment"
  • Update an existing Card (e.g., change name, list, add comments, archive/unarchive)
trello-cli update-card --card-id <card_id> --name "Updated Card Name" --list-id <new_list_id> --comment "New Comment" 
trello-cli update-card --card-id <card_id> --archive # to archive the card
trello-cli update-card --card-id <card_id> --unarchive # to unarchive the card
trello-cli update-card --help # for more information

Workflow Example

  1. Find your board ID:
trello-cli boards
  1. Find the desired list ID:
trello-cli lists --board-id <board_id>
  1. Check available labels:
trello-cli labels --board-id <board_id>
  1. Create a new card:
trello-cli add-card --list-id <list_id> --name "New Feature" --label <label_id> --comment "Priority task for sprint"
  1. Update or archive your cards if you want:
trello-cli update-card --card-id <card_id> --name "Updated Feature" --list-id <new_list_id> --archive

Help & References

I was unfamiliar with building installable packages in Python and it seemed fitting that a CLI tool should be pip installable. The following resources helped me a lot in understanding the process:

Also, I can't skip mentioning the excellent docs for Typer. It was a great learning experience building the CLI using it.

License

trello-cli is distributed under the terms of the MIT license.

About

A simple CLI for managing your trello cards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages