diff --git a/index.js b/index.js index 87ef29e9..2896a105 100644 --- a/index.js +++ b/index.js @@ -56,7 +56,8 @@ var usage = '\n' + chalk.bold('Usage:') + ' gulp ' + chalk.blue('[options]') + ' tasks'; -var parser = yargs.usage(usage, cliOptions); +var parser = yargs.usage(usage, cliOptions) + .help('help', cliOptions.help.desc); var opts = parser.argv; // Set up event listeners for logging temporarily. @@ -106,11 +107,6 @@ function handleArguments(env) { // Set up event listeners for logging again after configuring. toConsole(log, opts); - if (opts.help) { - console.log(parser.help()); - exit(0); - } - if (opts.version) { log.info('CLI version', cliVersion); if (env.modulePackage && typeof env.modulePackage.version !== 'undefined') { diff --git a/lib/shared/config/env-flags.js b/lib/shared/config/env-flags.js index c404e5f2..43ebb071 100644 --- a/lib/shared/config/env-flags.js +++ b/lib/shared/config/env-flags.js @@ -12,11 +12,11 @@ function mergeConfigToEnvFlags(env, config) { return copyProps(env, config, toFrom, convert, true); } -function convert(value, configKey, envKey) { - if (envKey === 'configBase') { - return path.dirname(value); +function convert(srcInfo, dstInfo) { + if (dstInfo.keyChain === 'configBase') { + return path.dirname(srcInfo.value); } - return value; + return srcInfo.value; } module.exports = mergeConfigToEnvFlags; diff --git a/lib/shared/config/load-files.js b/lib/shared/config/load-files.js index 3810c93e..54e73cd4 100644 --- a/lib/shared/config/load-files.js +++ b/lib/shared/config/load-files.js @@ -16,11 +16,11 @@ function loadConfigFiles(configFiles, configFileOrder) { copyProps(require(filePath), config, convert); - function convert(value, name) { - if (name === 'flags.gulpfile') { - return path.resolve(path.dirname(filePath), value); + function convert(srcInfo) { + if (srcInfo.keyChain === 'flags.gulpfile') { + return path.resolve(path.dirname(filePath), srcInfo.value); } - return value; + return srcInfo.value; } } diff --git a/package.json b/package.json index 5f566639..d87c64d5 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ }, "dependencies": { "archy": "^1.0.0", - "chalk": "^1.1.0", - "copy-props": "^1.4.1", + "chalk": "^1.1.3", + "copy-props": "^2.0.1", "fancy-log": "^1.1.0", "gulplog": "^1.0.0", "interpret": "^1.0.0", @@ -47,26 +47,26 @@ "pretty-hrtime": "^1.0.0", "semver-greatest-satisfied-range": "^1.0.0", "tildify": "^1.0.0", - "v8flags": "^2.0.9", + "v8flags": "^3.0.0", "wreck": "^6.3.0", - "yargs": "^3.28.0" + "yargs": "^7.1.0" }, "devDependencies": { "babel-preset-es2015": "^6.5.0", "babel-register": "^6.5.1", - "coveralls": "^2.7.0", + "coveralls": "2.11.15", "eslint": "^1.7.3", "eslint-config-gulp": "^2.0.0", "expect": "^1.20.2", - "fs-extra": "^0.26.1", + "fs-extra": "~2.0.0", "github-changes": "^1.0.1", "gulp": "gulpjs/gulp#4.0", "gulp-test-tools": "^0.6.1", - "jscs": "^2.3.5", + "jscs": "^3.0.7", "jscs-preset-gulp": "^1.0.0", "marked-man": "^0.1.3", "mocha": "^3.2.0", - "nyc": "^10.0.0" + "nyc": "^11.1.0" }, "keywords": [ "build", diff --git a/test/expected/flags-help.txt b/test/expected/flags-help.txt index fa313519..803eb06e 100644 --- a/test/expected/flags-help.txt +++ b/test/expected/flags-help.txt @@ -2,21 +2,35 @@ Usage: gulp [options] tasks Options: - --help, -h Show this help. [boolean] - --version, -v Print the global and local gulp versions. [boolean] - --require Will require a module before running the gulpfile. This is useful for transpilers but also has other applications. [string] - --gulpfile Manually set path of gulpfile. Useful if you have multiple gulpfiles. This will set the CWD to the gulpfile directory as well. [string] - --cwd Manually set the CWD. The search for the gulpfile, as well as the relativity of all requires will be from here. [string] - --verify Will verify plugins referenced in project's package.json against the plugins blacklist. - --tasks, -T Print the task dependency tree for the loaded gulpfile. [boolean] - --tasks-simple Print a plaintext list of tasks for the loaded gulpfile. [boolean] - --tasks-json Print the task dependency tree, in JSON format, for the loaded gulpfile. - --tasks-depth, --depth Specify the depth of the task dependency tree. - --compact-tasks Reduce the output of task dependency tree by printing only top tasks and their child tasks. [boolean] - --sort-tasks Will sort top tasks of task dependency tree. [boolean] - --color Will force gulp and gulp plugins to display colors, even when no color support is detected. [boolean] - --no-color Will force gulp and gulp plugins to not display colors, even when color support is detected. [boolean] - --silent, -S Suppress all gulp logging. [boolean] - --continue Continue execution of tasks upon failure. [boolean] - --log-level, -L Set the loglevel. -L for least verbose and -LLLL for most verbose. -LLL is default. [count] + --help, -h Show this help. [boolean] + --version, -v Print the global and local gulp versions. [boolean] + --require Will require a module before running the gulpfile. + This is useful for transpilers but also has other + applications. [string] + --gulpfile Manually set path of gulpfile. Useful if you have + multiple gulpfiles. This will set the CWD to the + gulpfile directory as well. [string] + --cwd Manually set the CWD. The search for the gulpfile, as + well as the relativity of all requires will be from + here. [string] + --verify Will verify plugins referenced in project's + package.json against the plugins blacklist. + --tasks, -T Print the task dependency tree for the loaded + gulpfile. [boolean] + --tasks-simple Print a plaintext list of tasks for the loaded + gulpfile. [boolean] + --tasks-json Print the task dependency tree, in JSON format, for + the loaded gulpfile. + --tasks-depth, --depth Specify the depth of the task dependency tree.[number] + --compact-tasks Reduce the output of task dependency tree by printing + only top tasks and their child tasks. [boolean] + --sort-tasks Will sort top tasks of task dependency tree. [boolean] + --color Will force gulp and gulp plugins to display colors, + even when no color support is detected. [boolean] + --no-color Will force gulp and gulp plugins to not display + colors, even when color support is detected. [boolean] + --silent, -S Suppress all gulp logging. [boolean] + --continue Continue execution of tasks upon failure. [boolean] + --log-level, -L Set the loglevel. -L for least verbose and -LLLL for + most verbose. -LLL is default. [count]