Skip to content

Instantly share code, notes, and snippets.

@ilyash-b
Last active January 11, 2021 15:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyash-b/afb356815d9f715ea9e7eef796751f70 to your computer and use it in GitHub Desktop.
Save ilyash-b/afb356815d9f715ea9e7eef796751f70 to your computer and use it in GitHub Desktop.
[trello] Add prefix to all cards on personal board in given list
#!/usr/bin/env ngs
F main(list_name:Str) {
AUTH = "?key=${ENV.TRELLO_API_KEY}&token=${ENV.TRELLO_API_TOKEN}"
board = ``curl -s "https://api.trello.com/1/members/me/boards${AUTH}"``.the_one({"name": /personal/})
list = ``curl -s "https://api.trello.com/1/boards/${board.id}/lists${AUTH}&cards=open"``.the_one({"name": list_name})
tag = list.name.split(' ')[0]
pfx = "[${tag}] "
list.cards.reject({'name': Pfx('[')}).each(F(card) {
echo("${card.name} -> ${pfx}${card.name}")
$(curl -X PUT "https://api.trello.com/1/cards/${card.id}${AUTH}&name=${encode_uri_component("${pfx}${card.name}")}")
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment