Updated Branches: refs/heads/master d8070b69e -> 0033b1e82
CB-4709 : add a foreach command to coho Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/db019fd2 Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/db019fd2 Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/db019fd2 Branch: refs/heads/master Commit: db019fd2c1093126c1b59b4eed5a91855227de2b Parents: d8070b6 Author: David Kemp <[email protected]> Authored: Fri Aug 30 08:14:45 2013 -0400 Committer: Andrew Grieve <[email protected]> Committed: Fri Aug 30 09:23:49 2013 -0400 ---------------------------------------------------------------------- coho | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/db019fd2/coho ---------------------------------------------------------------------- diff --git a/coho b/coho index 9938286..a437fb8 100755 --- a/coho +++ b/coho @@ -882,6 +882,27 @@ function repoPushCommand(argv) { }); } +function repoPerformShellCommand(argv) { + var opt = registerRepoFlag(optimist) + opt = registerHelpFlag(opt); + var argv = opt + .usage('Performs the supplied shell command in each repo directory.\n' + + '\n' + + 'Usage: $0 foreach "shell command"') + .argv; + + if (argv.h) { + optimist.showHelp(); + process.exit(1); + } + var repos = computeReposFromFlag(argv.r); + var cmd = argv._[1]; + forEachRepo(repos, function(repo) { + execHelper(cmd); + }); + process.exit(0); +} + function repoUpdateCommand(argv) { var opt = registerRepoFlag(optimist) var opt = opt @@ -1486,6 +1507,10 @@ function main() { name: 'upload-release', desc: 'Uploads a signed .zip to Cordova\'s webserver.', entryPoint: apacheUpload + }, { + name: 'foreach', + desc: 'Runs a shell command in each repo.', + entryPoint: repoPerformShellCommand } ]; var commandMap = {};
