Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp-cli should ignore arguments after first task #2379

Closed
dawidgarus opened this issue Sep 23, 2019 · 3 comments
Closed

gulp-cli should ignore arguments after first task #2379

dawidgarus opened this issue Sep 23, 2019 · 3 comments

Comments

@dawidgarus
Copy link

What were you expecting to happen?
gulp task --version and gulp task --help should execute task

What actually happened?
Gulp shows it's version/help page.

According to it's own help, options should come before tasks list:

Usage: gulp [options] tasks

Every additional options after tasks should be ignored by gulp and be assumed as the arguments for the tasks.
This will allow the task to use arguments that are currently restricted by gulp.
Also, adding new option to gulp won't break existing tasks because they might use it already for something else.

Please post a sample of your gulpfile (preferably reduced to just the bit that's not working)
N/A

What version of gulp are you using?
CLI version: 2.2.0
Local version: 4.0.2

What versions of npm and node are you using?
npm 6.2.0
node v10.9.0

@phated
Copy link
Member

phated commented Oct 1, 2019

Flags are not positional. You can use -- to separate trailing flags. e.g. gulp task -- --version

@phated phated closed this as completed Oct 1, 2019
@dawidgarus
Copy link
Author

dawidgarus commented Oct 1, 2019

@phated then gulp treats --version a task name:

>gulp --version
CLI version: 2.2.0
Local version: 4.0.2
>gulp default -- --version
[10:20:19] Using gulpfile [...]\gulpfile.js
[10:20:19] Task never defined: --version
[10:20:19] To list available tasks, try running: gulp --tasks

EDIT:
I've created issue for that: #2383

@phated
Copy link
Member

phated commented Oct 1, 2019

You're right. I'm not sure which behavior I prefer because I've seen people that might want to prefix their tasks with a symbol (like a -).

If we change this, it would be a breaking change in the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants