Created
August 17, 2017 13:40
-
-
Save wildcard/9b90e69a086f470f2e90ae5802b84413 to your computer and use it in GitHub Desktop.
Show Trello list cards in bitbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JQ=/usr/local/bin/jq | |
export $(egrep -v '^#' ~/.bitbar/.env | xargs) | |
TRELLO_API="https://api.trello.com/1" | |
TRELLO_AUTH_QS="key=$TRELLO_DEVELOPER_PUBLIC_KEY&token=$TRELLO_MEMBER_TOKEN" | |
TRELLO_LIST_ID=$(curl -s --request GET --url "$TRELLO_API/boards/$TRELLO_BOARD_ID/lists?$TRELLO_AUTH_QS" | $JQ ".[] | { name: .name, id: .id, match: (.name == \"$TRELLO_LIST_NAME\") } | select (.match) | .id" -r) | |
TRELLO_LIST=${TRELLO_LIST_ID:-$TRELLO_LIST_DEFAULT} | |
LIST_DATA=$(curl -s --request GET --url "$TRELLO_API/lists/$TRELLO_LIST/cards?$TRELLO_AUTH_QS") | |
LIST_LEN=$(echo $LIST_DATA | $JQ '. | length') | |
echo "Ideas Jar: ${LIST_LEN}" | |
echo "---" | |
if [ $LIST_LEN -gt 0 ]; then | |
for x in `seq 0 $((LIST_LEN-1))`; do | |
NAME=$(echo $LIST_DATA | $JQ ".[$x]| .name" -r) | |
LINK=$(echo $LIST_DATA | $JQ ".[$x]| .url" -r) | |
echo "$NAME|length=35 href=$LINK" | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Follow the instructions here for Trello auth https://github.com/weavenet/trello_cli#setup
You need to create a file in
~/.bitbar/.env
with the followingTRELLO_BOARD_ID
the board you're looking into, you can get it from the url in TrelloTRELLO_LIST_NAME
name of the list in the boardTRELLO_LIST_DEFAULT
id of list to fallback to if no list is found in board