cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/2] git commit: Organize list of commands in --help into groups
Date Thu, 24 Apr 2014 17:52:12 GMT
Organize list of commands in --help into groups


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/608e06d9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/608e06d9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/608e06d9

Branch: refs/heads/master
Commit: 608e06d935b423dbf051051417fe893b91999991
Parents: dcf5585
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Apr 24 13:51:54 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Apr 24 13:51:54 2014 -0400

----------------------------------------------------------------------
 src/main.js | 45 ++++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/608e06d9/src/main.js
----------------------------------------------------------------------
diff --git a/src/main.js b/src/main.js
index 9b79bfd..4b3f4db 100644
--- a/src/main.js
+++ b/src/main.js
@@ -26,7 +26,7 @@ try {
 }
 
 module.exports = function() {
-    var commandList = [
+    var repoCommands = [
         {
             name: 'repo-clone',
             desc: 'Clones git repositories into the current working directory.',
@@ -51,11 +51,8 @@ module.exports = function() {
             name: 'list-repos',
             desc: 'Shows a list of valid values for the --repo flag.',
             entryPoint: require('./list-repos')
-        }, {
-            name: 'list-pulls',
-            desc: 'Shows a list of GitHub pull requests for all specified repositories.',
-            entryPoint: require('./list-pulls')
-        }, {
+        }];
+    var releaseCommands = [{
             name: 'prepare-release-branch',
             desc: 'Branches, updates JS, updates VERSION. Safe to run multiple times.',
             entryPoint: require('./cadance-release').prepareReleaseBranchCommand
@@ -84,6 +81,15 @@ module.exports = function() {
             desc: 'Prints out tags & hashes for the given repos. Used in VOTE emails.',
             entryPoint: require('./print-tags')
         }, {
+            name: 'list-release-urls',
+            desc: 'List the apache git repo urls for release artifacts.',
+            entryPoint: require('./list-release-urls')
+        }];
+    var otherCommands = [{
+            name: 'list-pulls',
+            desc: 'Shows a list of GitHub pull requests for all specified repositories.',
+            entryPoint: require('./list-pulls')
+        }, {
             name: 'last-week',
             desc: 'Prints out git logs of things that happened last week.',
             entryPoint: require('./last-week')
@@ -91,22 +97,27 @@ module.exports = function() {
             name: 'for-each',
             desc: 'Runs a shell command in each repo.',
             entryPoint: require('./for-each')
-        }, {
-            name: 'list-release-urls',
-            desc: 'List the apache git repo urls for release artifacts.',
-            entryPoint: require('./list-release-urls')
         }
     ];
     var commandMap = {};
-    for (var i = 0; i < commandList.length; ++i) {
-        commandMap[commandList[i].name] = commandList[i];
+    function addToCommandMap(cmd) {
+        commandMap[cmd.name] = cmd;
     }
-    var usage = 'Usage: $0 command [options]\n' +
-               '\n' +
-               'Valid commands:\n';
-    for (var i = 0; i < commandList.length; ++i) {
-        usage += '    ' + commandList[i].name + ': ' + commandList[i].desc + '\n';
+    repoCommands.forEach(addToCommandMap);
+    releaseCommands.forEach(addToCommandMap);
+    otherCommands.forEach(addToCommandMap);
+
+    var usage = 'Usage: $0 command [options]\n\n';
+    function addCommandUsage(cmd) {
+        usage += '    ' + cmd.name + ': ' + cmd.desc + '\n';
     }
+    usage += 'Repo Management:\n';
+    repoCommands.forEach(addCommandUsage);
+    usage += '\nRelease Management:\n';
+    releaseCommands.forEach(addCommandUsage);
+    usage += '\nOther Commands:\n';
+    otherCommands.forEach(addCommandUsage);
+
     usage += '\nFor help on a specific command: $0 command --help\n\n';
     usage += 'Some examples:\n';
     usage += '    ./cordova-coho/coho repo-clone -r plugins -r mobile-spec -r android -r
ios -r cli\n';


Mime
View raw message