Created
July 27, 2019 17:33
-
-
Save abdus/ca347bef4dfce444177e655247cc52d9 to your computer and use it in GitHub Desktop.
This file contains 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
const fetch = require('node-fetch') | |
const { execSync } = require('child_process') | |
async function getRepoURLs(user) { | |
let gh_data = await fetch(`https://api.github.com/users/${user}/repos`) | |
gh_data = await gh_data.json() | |
return gh_data | |
} | |
async function main() { | |
if (!process.argv[2]) | |
throw new Error(`You must provide a valid Github username.`) | |
let repos = await getRepoURLs(process.argv[2]) | |
for (let i of repos) { | |
const output = execSync( | |
`git clone ${i.html_url}.git ./output/${i.name}` | |
).toString() | |
console.log(output) | |
} | |
return | |
} | |
main().catch(console.log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment