Created
December 29, 2014 09:53
-
-
Save ssddi456/e82eaf004deb1a7e7995 to your computer and use it in GitHub Desktop.
group git repos
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
var cp = require('child_process'); | |
var fs = require('fs'); | |
var cmd = 'git config --get remote.origin.url'; | |
var jd_git = 'code.jd.com'; | |
fs.readdirSync('.').forEach(function( dir ) { | |
try{ | |
var stat = fs.statSync(dir); | |
}catch(e){ | |
console.log( dir ); | |
return; | |
} | |
if( stat.isDirectory() ){ | |
cp.exec(cmd,{cwd:dir},function( err, stdout ) { | |
if( stdout.toString().indexOf(jd_git) != -1 ){ | |
console.log( dir ); | |
console.log( stdout ); | |
} | |
}) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment