Skip to content

Commit

Permalink
A quick script to display Asana workspace IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
limulus committed Jan 14, 2015
1 parent a44e1a7 commit 378d9e6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bin/show-asana-workspaces
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env node

"use strict"

var asana = require("asana")

var apiKey = process.env["ASANA_API_KEY"] || process.argv[2]

if (! apiKey) {
process.stderr.write("Usage: show-asana-workspaces <asana-api-key>\n\n")
process.exit(1)
}

var client = asana.Client.create()
client.useBasicAuth(apiKey)
client.workspaces.findAll()
.then(function (workspaces) {
process.stdout.write(JSON.stringify(workspaces, null, 2) + "\n\n")
process.exit(0)
})
.catch(function (err) {
process.stderr.write("Failed fetch of workspaces from Asana. Here's the error:\n\n")
process.stderr.write(JSON.stringify(err, null, 2) + "\n\n")
process.exit(1)
})

0 comments on commit 378d9e6

Please sign in to comment.