[Groonga-commit] groonga/gcs [master] Chain "parse()"

アーカイブの一覧に戻る

null+****@clear***** null+****@clear*****
2012年 8月 6日 (月) 17:08:57 JST


SHIMODA Hiroshi	2012-08-06 17:08:57 +0900 (Mon, 06 Aug 2012)

  New Revision: c4c93e58834b2c0eca03544a2dafc744833b009b
  https://github.com/groonga/gcs/commit/c4c93e58834b2c0eca03544a2dafc744833b009b

  Log:
    Chain "parse()"

  Modified files:
    bin/cs-configure-fields
    bin/cs-create-domain
    bin/cs-delete-domain
    bin/cs-describe-domain
    bin/gcs
    lib/command-line.js

  Modified: bin/cs-configure-fields (+2 -2)
===================================================================
--- bin/cs-configure-fields    2012-08-06 17:05:57 +0900 (9230d45)
+++ bin/cs-configure-fields    2012-08-06 17:08:57 +0900 (d8b8cbd)
@@ -16,9 +16,9 @@ commandLine
           'The name of the domain that you are configuring. Required.',
           String)
   .option('--delete',
-          'Delete the field specified by the --name and --type options.');
+          'Delete the field specified by the --name and --type options.')
+  .parse();
 
-commandLine.parse();
 commandLine.assertHaveDomainName();
 commandLine.assertDomainExists();
 

  Modified: bin/cs-create-domain (+2 -2)
===================================================================
--- bin/cs-create-domain    2012-08-06 17:05:57 +0900 (fb530ca)
+++ bin/cs-create-domain    2012-08-06 17:08:57 +0900 (f7dbb0a)
@@ -7,9 +7,9 @@ commandLine
   .usage('--domain-name <domain name> [options]')
   .option('-d, --domain-name <domain name>',
           'The name of the domain that you are creating. Required.',
-          String);
+          String)
+  .parse();
 
-commandLine.parse();
 commandLine.assertHaveDomainName();
 
 if (commandLine.domain.exists()) {

  Modified: bin/cs-delete-domain (+2 -3)
===================================================================
--- bin/cs-delete-domain    2012-08-06 17:05:57 +0900 (c7155dc)
+++ bin/cs-delete-domain    2012-08-06 17:08:57 +0900 (6491512)
@@ -9,9 +9,8 @@ commandLine
           'The name of the domain that you are deleting. Required.',
           String)
   .option('-f, --force',
-          'Delete the domain without prompting for confirmation.');
-
-commandLine.parse();
+          'Delete the domain without prompting for confirmation.')
+  .parse();
 
 commandLine.assertHaveDomainName();
 commandLine.assertDomainExists();

  Modified: bin/cs-describe-domain (+2 -3)
===================================================================
--- bin/cs-describe-domain    2012-08-06 17:05:57 +0900 (0a2e0a4)
+++ bin/cs-describe-domain    2012-08-06 17:08:57 +0900 (6ba9890)
@@ -11,9 +11,8 @@ commandLine
   .option('-all, --show-all',
           'Display all available information for the domain, '
              + 'including configured fields.',
-          String);
-
-commandLine.parse();
+          String)
+  .parse();
 
 function report(domain) {
   console.log('Domain Name               %s', domain.name);

  Modified: bin/gcs (+2 -3)
===================================================================
--- bin/gcs    2012-08-06 17:05:57 +0900 (9ef21f7)
+++ bin/gcs    2012-08-06 17:08:57 +0900 (084a135)
@@ -14,9 +14,8 @@ commandLine
           'list of IP ranges for privileged client '+
             '[' + CLI.defaultPrivilegedRanges + ']',
           String,
-          CLI.defaultPrivilegedRanges);
-
-commandLine.parse();
+          CLI.defaultPrivilegedRanges)
+  .parse();
 
 var server = gcsServer.createServer({
       databasePath:     commandLine.options.databasePath,

  Modified: lib/command-line.js (+8 -3)
===================================================================
--- lib/command-line.js    2012-08-06 17:05:57 +0900 (c83e79a)
+++ lib/command-line.js    2012-08-06 17:08:57 +0900 (1b65752)
@@ -17,7 +17,7 @@ function CommandLineInterface() {
       .option('--database-path <path>',
               'database path [' + defaultDatabasePath + ']',
               String,
-              defaultDatabasePath)
+              defaultDatabasePath);
 }
 CommandLineInterface.prototype = {
   get databasePath() {
@@ -37,12 +37,15 @@ CommandLineInterface.prototype = {
 
   parse: function() {
     this.program.parse(process.argv);
+    return this;
   },
   usage: function() {
-    return this.program.option.apply(this.program, arguments);
+    this.program.option.apply(this.program, arguments);
+    return this;
   },
   option: function() {
-    return this.program.option.apply(this.program, arguments);
+    this.program.option.apply(this.program, arguments);
+    return this;
   },
 
   assertHaveDomainName: function() {
@@ -50,6 +53,7 @@ CommandLineInterface.prototype = {
       console.log('You must specify the domain name.');
       process.exit(1);
     }
+    return this;
   },
 
   assertDomainExists: function() {
@@ -57,6 +61,7 @@ CommandLineInterface.prototype = {
       console.log('You must specify an existing domain name.');
       process.exit(1);
     }
+    return this;
   },
 };
 exports.CommandLineInterface = CommandLineInterface;
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
ダウンロード 



Groonga-commit メーリングリストの案内
アーカイブの一覧に戻る