Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
docs: add a very minimal --help flag
Browse files Browse the repository at this point in the history
Unfortunately, nconf only provides usage for arguments specifically
configured through the argv stores. Arguments converted from other
stores are not displayed. Since we don't configure any specific argument
for the command-line, no help is displayed.

Fix #54.
  • Loading branch information
vincentbernat committed Apr 29, 2017
1 parent 48d8964 commit 50b291a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

var nconf = require('nconf'),
path = require('path'),
net = require('net');
net = require('net'),
version = require('../package.json').version;

nconf
.argv()
.argv({}, 'Usage: $0\n\nSee http://dashkiosk.readthedocs.io/en/v'
+ version
+ '/configuration.html for more information.')
.env('__')
.defaults({
configuration: './config.json',
Expand Down Expand Up @@ -63,4 +66,8 @@ nconf
}
});

if (nconf.get('help') || nconf.get('h')) {
process.exit(nconf.stores.argv.showHelp());
}

module.exports = nconf;

0 comments on commit 50b291a

Please sign in to comment.