[Groonga-commit] groonga/gcs [master] Command line interface still must have databasePath

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Oct 22 11:18:32 JST 2012


YUKI Hiroshi	2012-10-22 11:18:32 +0900 (Mon, 22 Oct 2012)

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

  Log:
    Command line interface still must have databasePath

  Modified files:
    lib/command-line.js

  Modified: lib/command-line.js (+13 -0)
===================================================================
--- lib/command-line.js    2012-10-22 11:08:02 +0900 (e33926f)
+++ lib/command-line.js    2012-10-22 11:18:32 +0900 (94ee0fa)
@@ -2,6 +2,9 @@ var program = require('commander');
 var version = require('../package').version;
 var path = require('path');
 
+var defaultDatabasePath =
+      exports.defaultDatabasePath =
+      CommandLineInterface.defaultDatabasePath = process.env.GCS_DATABASE_PATH || process.env.HOME + '/.gcs/database/gcs';
 var defaultPort =
       exports.defaultPort =
       CommandLineInterface.defaultPort = process.env.GCS_PORT || 7575;
@@ -38,6 +41,10 @@ CommandLineInterface.prototype = {
     return this.host + ':' + this.port;
   },
 
+  get databasePath() {
+    return this.options.databasePath || defaultDatabasePath;
+  },
+
   get options() {
     return this.program;
   },
@@ -55,6 +62,12 @@ CommandLineInterface.prototype = {
     }, this);
 
     this.program
+      .option('--database-path <path>',
+              'database path' +
+                '(GCS_DATABASE_PATH) ' +
+                '[' + defaultDatabasePath + ']',
+              String,
+              defaultDatabasePath)
       .option('-p, --port <port>',
               'specify port' +
                 '(GCS_PORT) ' +
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index