-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
PowerShell on Windows tab completed paths lead to inconsistent parsing #416
Comments
Yeah, that behavior of powershell is pretty frustrating. I'm honestly surprised it can't be toggled, at least not anyway that seems obvious to me. That being said, I don't think we will be able to work around that behavior. It would require a custom command line parser, which is a kind of notoriously complex thing to do. Having a custom CommandLineToArgvW for this scenario would almost certainly break others as we play whack a mole trying to match the normal behavior with our custom one. I vote creating an issue with the powershell team. This is more than just a Spectre issue or even .net |
One thing I forgot to add is I've been toying around with the idea of adding auto completion to CLI app and there might be an opportunity to override this behavior. Issue #267 tracks this. No progress yet, but I'll definitely keep this scenario in mind |
Am not 100% sure this is the same underlying issue but... I have a app which I call like this: The quotes are added to the last arg in case the directory path includes a space. If the path includes the trailing backslash like shown above, then the property value that ends up in the (Command)Settings is: If the trailing backslash is not included, the Settings value is interpretted correctly: [UPDATE] [UPDATE 2] |
Information
Describe the bug
If a user tab-completes a path in PowerShell on Windows that includes a space, the resulting path gets parsed sort-of-incorrectly resulting in arguments being merged together and generally strange quoting behaviour. This all comes from the fact that PowerShell's behaviour is to use quotes with a backslash as path separator and includes a trailing slash, essentially escaping the end of the path.
To Reproduce
I've created a simple-ish repro with samples at this repo that should explain things a little more clearly.
Expected behavior
I understand that this isn't really Spectre.Console's problem and is really just crappy behaviour from PowerShell but if there was a way to flag an argument as being a path so that it was parsed differently that might be useful? or avoiding this behaviour is already possible and I'm an idiot 😆
Screenshots
Additional context
This is unique to PowerShell on Windows since
cmd
doesn't default to including the trailing slash, andpwsh
on other platforms uses their much saner path separator.Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered: