gulpjs / gulp-cli

Command Line Interface for gulp.
MIT License
401 stars 106 forks source link

--compact-tasks flag does not work #232

Closed Jack-Works closed 3 years ago

Jack-Works commented 3 years ago

Before you open this issue, please complete the following tasks:

What were you expecting to happen?

npx gulp --help

returns

  --compact-tasks         Reduce the output of task dependency tree by printing 
                          only top tasks and their child tasks.        [boolean]

What actually happened?

npx gulp --compact-tasks

[14:46:35] Requiring external module ts-node/register
[14:46:35] Using gulpfile gulpfile.ts
[14:46:35] Task never defined: default
[14:46:35] To list available tasks, try running: gulp --tasks

Please provide the following information:

phated commented 3 years ago

Moving this to the CLI repo - @sttk can you investigate?

sttk commented 3 years ago

@Jack-Works I remembered and confirmed that --compact-tasks does not work alone. This flag have to be used with --tasks.

Jack-Works commented 3 years ago

I tried npx gulp --tasks --compact-tasks but it emits the same output as --tasks alone. (Tasks didn't "compact")

sttk commented 3 years ago

The following is an example I confirmed:

$ npm init
$ npm install -D gulp
$ npm install -D ts-node typescript @types/gulp
$ node -v
16.5.0
$ npm -v
6.10.3
$ npx gulp -v
CLI version: 2.3.0
Local version: 4.0.2
$ cat <<EOF > gulpfile.ts
import { task, series } from 'gulp';

const a1 = (cb: Function) => {
  console.log('a1');
  cb();
};

task('a2', series(a1));

exports.default = series(a1, 'a2')
EOF
$ npx gulp --tasks
[05:32:20] Requiring external module ts-node/register
[05:32:21] Tasks for ~/path/to/gulp-cli-issue-232/gulpfile.ts
[05:32:21] ├─┬ a2
[05:32:21] │ └─┬ <series>
[05:32:21] │   └── a1
[05:32:21] └─┬ default
[05:32:21]   └─┬ <series>
[05:32:21]     ├── a1
[05:32:21]     └─┬ a2
[05:32:21]       └─┬ <series>
[05:32:21]         └── a1
$ npx gulp --tasks --compact-tasks
[05:33:31] Requiring external module ts-node/register
[05:33:32] Tasks for ~/path/to/gulp-cli-issue-232/gulpfile.ts
[05:33:32] ├─┬ a2
[05:33:32] │ └─┬ <series>
[05:33:32] │   └── a1
[05:33:32] └─┬ default
[05:33:32]   └─┬ <series>
[05:33:32]     ├── a1
[05:33:32]     └── a2
$
phated commented 3 years ago

As documented:

Reduce the output of task dependency tree by printing only top tasks and their child tasks. This flag can be used with --tasks or --tasks-json.

This seems correct, so I'll close this.