Skip to content

Instantly share code, notes, and snippets.

@tbranyen
Created September 30, 2011 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tbranyen/1254497 to your computer and use it in GitHub Desktop.
Save tbranyen/1254497 to your computer and use it in GitHub Desktop.
clone all gists
#!/usr/bin/env node
var request = require("request");
var exec = require("child_process").exec;
if (process.argv.length < 3) {
console.log("Missing username argument");
}
var username = process.argv[2];
request.get("http://gist.github.com/api/v1/json/gists/" + username,
function(err, res, body) {
var obj = JSON.parse(body);
if (!obj || !obj.gists || !obj.gists.length) {
console.log("No gists to clone");
}
obj.gists.forEach(function(gist) {
console.log("Cloning", gist.repo);
exec("git clone git://gist.github.com/" + gist.repo + ".git");
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment