Think about smarter usage of double-dash
See original GitHub issueThere are a some quantity of issues about parameterization tasks in gulp and probably I have an idea that can be suitable for everyone.
By default it marks the end of parameter (option) list.
…a double dash (–) is used in bash built-in commands and many other commands to signify the end of command options, after which only positional parameters are accepted. © http://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash
But npm run-script
passes arguments after the first --
directly to the script and it feels like this one is really familiar for nodejs community. Fellows uses --
as a delimiter for passing arguments inside like we need to pass them in tasks.
https://github.com/npm/npm/blob/d081cc6c8d73f2aa698aab36605377c95e916224/lib/run-script.js#L14
Similar logic exists in yarn
: https://github.com/yarnpkg/yarn/blob/3dc9cf43448da51d3b8890de339a0ed27b12ca62/src/cli/index.js#L31
Gulp is the thing full of tasks and I don’t see a real reason why we can’t use --
as like npm
or yarn
do.
I’m just curious if someone already uses tasks beginning with minus signs like -js
or --hello
(it’s hard to even imagines because of that: gulp -- --hello
) but if we really need it we can go yarn
way and use the second double dash as a marker for args for tasks: gulp -- --still-a-task --and-this-one-too -- arguments for tasks
.
It’s a bunch of very simple fixes in code and I’m ready to make a PR.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@contra Can we ignore anything after
--
and not treat as commands for gulp? I guess there are a lot of people who really need it.Because that isn’t our philosophy. I don’t understand why you continue to harp on this. We’ve already made this decision and you aren’t going to convince me to change it.
You say that bash isn’t for task runners but you keep referencing ~task~package managers as your examples, which is an insane double-standard.
We aren’t going to do this so you can just stop.