From 79aec36f24b35329da809f36d5d164efeeab41ed Mon Sep 17 00:00:00 2001 From: jan-molak Date: Mon, 8 Aug 2016 20:10:57 +0100 Subject: [PATCH] Corrected the indentation and added a test to cover the optional configuration object that can be passed to `commandDir` --- yargs/yargs-tests.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 20e663f9b1..c964e1b724 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -236,10 +236,10 @@ function completion_async() { } function Argv$help() { - var yargs1 = yargs - .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); - - yargs1.help().argv; + var argv = yargs + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]") + .help() + .argv; } function Argv$showHelpOnFail() { @@ -323,8 +323,23 @@ function Argv$reset() { } } +// http://yargs.js.org/docs/#methods-commanddirdirectory-opts function Argv$commandDir() { var ya = yargs .commandDir('.') .argv } + + +// http://yargs.js.org/docs/#methods-commanddirdirectory-opts +function Argv$commandDirWithOptions() { + var ya = yargs + .commandDir('.', { + recurse: false, + extensions: ['js'], + visit: (commandObject: any, pathToFile: string, filename: string) => { }, + include: /.*\.js$/, + exclude: /.*\.spec.js$/, + }) + .argv +}