Skip to content

Instantly share code, notes, and snippets.

@hackugyo
Last active November 7, 2015 12:32
Show Gist options
  • Select an option

  • Save hackugyo/c1be19a660fe97e07813 to your computer and use it in GitHub Desktop.

Select an option

Save hackugyo/c1be19a660fe97e07813 to your computer and use it in GitHub Desktop.
Trelloのカードを削除する
{
"name": "node-trello-deleter",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"trello-deleter" : "./trello_deleter.coffee",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"node-trello": "1.0.0"
},
"author": "",
"license": "ISC"
}
#!/usr/bin/env coffee
# in npm 1.x, call me as $npm --idCard=CARD_ID_TO_BE_DELETED --idList=LIST_ID --yourApiKey=YOUR_API_KEY --yourToken=YOUR_TOKEN run-script trello-deleter.
# in npm 2.x, call me as $npm run-script trello-deleter -- --yourApiKey=YOUR_API_KEY --yourToken=YOUR_TOKEN --idList=LIST_ID --idCard=CARD_ID_TO_BE_DELETED
# http://stackoverflow.com/a/26545792
Trello = require("node-trello");
t = new Trello(process.env.npm_config_yourApiKey, process.env.npm_config_yourToken);
if process.env.npm_config_idCard?
url = "/1/cards/#{process.env.npm_config_idCard}"
console.log "DELETE #{url}"
t.del url, (err, data) =>
if (err)
throw err
console.log(data)
if process.env.npm_config_idList?
t.get "/1/lists/#{process.env.npm_config_idList}/cards", (err, data) =>
if (err)
throw err
names = []
for card in data
names.push("#{card.name} : #{card.id}")
console.log("\n#{names.join('\n')}\n")
@hackugyo

hackugyo commented Nov 6, 2015

Copy link
Copy Markdown
Author

$ git clone https://gist.github.com/c1be19a660fe97e07813.git
$ cd c1be19a660fe97e07813
$ npm install
$ npm --idCard=CARD_ID_TO_BE_DELETED --idList=LIST_ID
--yourApiKey=YOUR_API_KEY --yourToken=YOUR_TOKEN run-script trello-deleter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment