[api] Reparse argv arguments on system.loadArgv()
It allows manipulating `process.argv` on the fly while still being able to use nconf `System` store.
This commit is contained in:
parent
51700cae88
commit
bbc5885fc1
1 changed files with 5 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
var util = require('util'),
|
||||
optimist = require('optimist'),
|
||||
Memory = require('./memory').Memory;
|
||||
|
||||
//
|
||||
|
@ -79,10 +80,10 @@ System.prototype.loadArgv = function () {
|
|||
argv;
|
||||
|
||||
if (typeof this.argv === 'object') {
|
||||
argv = require('optimist').options(this.argv).argv;
|
||||
argv = optimist(process.argv.slice(2)).options(this.argv).argv;
|
||||
}
|
||||
else if (this.argv) {
|
||||
argv = require('optimist').argv;
|
||||
argv = optimist(process.argv.slice(2)).argv;
|
||||
}
|
||||
|
||||
if (!argv) {
|
||||
|
@ -115,3 +116,4 @@ System.prototype.loadEnv = function () {
|
|||
|
||||
return this.store;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue