Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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') {
Expand Down
8 changes: 4 additions & 4 deletions lib/shared/config/env-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
8 changes: 4 additions & 4 deletions lib/shared/config/load-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
48 changes: 31 additions & 17 deletions test/expected/flags-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]