Skip to content

Instantly share code, notes, and snippets.

@alejandro
Created December 2, 2011 05:33
Show Gist options
  • Select an option

  • Save alejandro/1421916 to your computer and use it in GitHub Desktop.

Select an option

Save alejandro/1421916 to your computer and use it in GitHub Desktop.
Clone all your gists
#!/usr/bin/env node
var request = require("request");
var exec = require("child_process").exec;
if (process.argv.length < 3) {
console.log("Ocupo un usuario");
}
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 que clonar");
}
obj.gists.forEach(function(gist) {
console.log("Clonando", gist.repo);
exec("git clone git://gist.github.com/" + gist.repo + ".git", function(err,d){
console.log(err || d)
});
});
}
);
//use
node gists USERNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment