Opting out of -- token parsing to improve interop with called programs #18143
Replies: 2 comments 2 replies
-
This seems to work as normal for me PS C:\Users\vagrant-domain> C:\temp\print_argv.exe arg1 -- test
"C:\temp\print_argv.exe" arg1 -- test
[1] arg1
[2] --
[3] test The |
Beta Was this translation helpful? Give feedback.
-
Hello. I went down a rabbit hole of trying to obtain the raw command and re-parsing that, but it feels dangerous and convoluted. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
PowerShell does a lot of processing on behalf of its cmdlets, advanced functions etc. Sometimes this is a problem when you want to make "advanced aliases" (which in PowerShell will have to be functions). For example:
The problem is that -- means something in Git, beyond just terminating option parsing: It separates revision arguments from file arguments. So I'd like to say,
And this might work... but git never sees the -- token, so it might also not work, if there is any ambiguity. There is no way to have PowerShell not process this token so it can be passed on to sub-programs.
I deliberately make "ggl" a non-advanced function, since otherwise PowerShell would interfere even more with parsing.
Beta Was this translation helpful? Give feedback.
All reactions