Last active
November 7, 2015 12:32
-
-
Save hackugyo/c1be19a660fe97e07813 to your computer and use it in GitHub Desktop.
Trelloのカードを削除する
This file contains hidden or 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
| { | |
| "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" | |
| } |
This file contains hidden or 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
| #!/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") |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ 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