-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 treats flags after -- as task names #2383
Comments
(copied from the other issue) 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. This is going to take some more thinking through and probably end-user feedback. |
I think it's correct to regard all arguments after |
So there is no safe way to pass arbitrary arguments to gulp task? |
I have considered before about task's flags to make naming spec., for example:
If there are any ways to distinguish flags for tasks from normal flags (for gulp), this could be solved with no risk and avoiding breaking changes. |
In the future, maybe we can add configuration in the module.exports = {
ignoreFlags: ['--version']
}; And then if you ran In the meantime, @sttk's suggestion is a great way to do things. You can even document those flags with the tasks using task metadata! |
@sttk @phated Yeah, imagine writing commands like module.exports = {
ignoreFlagsAfterTask: true
}; |
I'm not enjoying this pushy tone. We've given some solutions and possible future enhancements. I'm sorry if that is not sufficient. As for any questions about why arguments are parsed in a specific manner, please go ask yargs. We use them for all argument parsing and I'm sure they have a reason for it. |
I'm sorry if my opinion came up as pushy. I've presented constructive criticism of proposed solutions, which highlighted flaws (some of which are majorly inconvenient) in those solutions, how to improve upon then and a viable alternative. EDIT: it's worth to mention that this is similar how node command works: node [options] script [arguments]. |
@dawidgarus I'm sorry about my bad idea. Your point is just the reason I hadn't presented in the past. BTW, I have a question about your idea. Gulp can combine multiple tasks with |
In addition, if we support arguments for tasks, we might need to consider about passing them to tasks via |
Personally, I would leave it up to the users. They still have access full list of arguments via |
@dawidgarus I've understood. To place a flag after a task name does not mean that the task just before uses the flag but that Gulp just ignores the flag. I'm sorry that my understanding is late. Since I sometimes add a flag after task names, I want a flag in Based on that, now I think @phated's idea, Gulp ignores flags after |
Agreed.
I agree, but there are situations where this cannot be done given gulp's current parsing scheme (If there is, please let me know 😄 ). For example a gulp task cannot print its own help text because gulp will intercept, print gulp's help text, then and exit before invoking the task. If gulp were to recognize |
What actually happened?
What were you expecting to happen?
Gulp should ignore all cli arguments after --
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 10.9.0
The text was updated successfully, but these errors were encountered: