-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(flags): script arguments come after '--' #3621
Conversation
That's prevent us to build a real command application. Suppose we implement git with deno, we have to use it like these:
A new user query helps with |
Not per se - instead of aliasing |
An alias is not a real command, it only works in current shell, when you switch to another shell, or call with other processes such as A reasonable way is write an executable file named as command, with content like this: #!/usr/bin/env -S deno --allow-something your user download it and put it into |
@Fenzland This works for me
|
That was on OSX. When I try it on linux I do indeed get an error. Hrm. Is the issue that env tries to interpret the "--" ? |
@ry You need the The unnamed arg behaviour which allows this isn't really intuitive and I believe #3011 (wrongly closed 😅) was actually reporting against it as a bug. Confused yet? |
@nayeemrmn |
Due to complaints about ergonomics and because it breaks shebang on linux. This reverts commit 2d5457d.
@ry Yeah, 8.30+ as I once wrote here denoland/std#545. (It actually never worked with mine either :P) Nevertheless it's the only solution on Linux going forward. |
The Linux kernel handles shebangs in a way that's unfriendly to passing more than one explicit argument (the remainder of the line gets passed to the first command as a single argument, together with the name of the file as a second). I guess the Gnu version of Instead of starting your script with:
(or possibly with a
What's happening? The first line says to execute the rest of the file as a shell script. When doing so, it will never go further than the second line, so the rest of the file can be JS or TypeScript. When the file is run by deno, the first line will be ignored as a shebang, and the second line (and rest of the file) gets interpreted as JS/TS. So the second line has to be a "polyglot", that is has to make sense both when interpreted as shell and when interpreted as JS/TS. It makes sense when interpreted as JS/TS because it's just a string 'exec' followed by a comment. It makes sense when interpreted as shell because the quotes around exec are stripped, and then the rest of the line up to the The arguments to First, the path to Next we pass arguments Depending on whether the feature being discussed here is included or reverted (as it is when I write this comment), you might need to insert a |
Fixes #3469