├── .gitignore ├── test ├── config │ └── test-config.json ├── test.demand.js ├── test.description.js ├── test.oneof.js ├── test.comboof.js ├── test.load.js └── test.command.demand.js ├── .jshintrc ├── package.json ├── example └── example.js ├── LICENSE ├── README.md └── lib └── start.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | -------------------------------------------------------------------------------- /test/config/test-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": "bar", 3 | "baz": "buz" 4 | } 5 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "passfail": false, 3 | "maxerr": 100, 4 | "node": true, 5 | "forin": false, 6 | "boss": true, 7 | "noarg": true, 8 | "undef": true, 9 | "unused": true, 10 | "browser": true, 11 | "laxbreak": true, 12 | "laxcomma": true, 13 | "eqeqeq": true, 14 | "eqnull": true, 15 | "expr": true, 16 | "indent": 2, 17 | "white": false, 18 | "predef": [ 19 | "exports", 20 | "require", 21 | "process" 22 | ], 23 | "es5": true, 24 | "esnext": true, 25 | "shadow": false, 26 | "supernew": false, 27 | "strict": false 28 | } 29 | -------------------------------------------------------------------------------- /test/test.demand.js: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | const program = require('../lib/start'), 6 | should = require('should'); 7 | 8 | program 9 | .version('0.0.1') 10 | .option('-f, --foo ', 'add some ') 11 | .demand('foo'); 12 | 13 | var helpInfo = program.helpInformation(); 14 | helpInfo.should.include("[required] add some "); 15 | 16 | -------------------------------------------------------------------------------- /test/test.description.js: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | const program = require('../lib/start'), 6 | path = require('path'), 7 | should = require('should'); 8 | 9 | program 10 | .version('0.0.1') 11 | .description('a little useful text to explain the purpose of the tool') 12 | .parse(['node', 'test', '--help']); 13 | 14 | var helpInfo = program.helpInformation(); 15 | helpInfo.should.include("a little useful text"); 16 | 17 | -------------------------------------------------------------------------------- /test/test.oneof.js: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | const program = require('../lib/start'), 6 | path = require('path'), 7 | should = require('should'); 8 | 9 | program 10 | .version('0.0.1') 11 | .option('--onlyone