Repository navigation
ls, rm, cp, open, touch, mkdir: Don't expand tilde if input path is quoted string or a variable. - #12232
Conversation
|
It seems good to me. One slightly weird thing about it is that I'd be fine merging it, but maybe someone else could look at it as well. |
|
Then let's merge it and see how it works :) |
|
I know my issue is partially to blame for this, but I'd say this doesn't cover all use cases. :P It should be possible to get path expansion while still having spaces in the path. Ideally we would have one quote type for that, and another quote type with the new behavior. E.g., maybe backtick (`), unless we're planning something else with that. Or we could adopt the Bash behavior and use the |
|
Thanks for your feedback! ls `~/aa bb`
ls "~/aa bb" |
|
Oh :S You're totally, completely right. I think a backtick placement issue from my path tab completion must have confused me or something. Thank you for the response! By the way, do you have any answer to a good implementation of tab completion to file paths with spaces? There have been a lot of changes in Nushell, and my code is barely functional at this point! :P |
Sorry I don't, I don't touch much of tab completion of nushell, but I think it needs to be changed to fit new rules. |
|
No worries :) |
Should the backtick difference be mentioned in working with strings? |
|
They should be different, I think the documentation is outdated. Currently backtick is simply a bare word, but it allows to have spaces. So: and are the same thing, but have some difference to |
Description
Fixes: #11887
Fixes: #11626
This pr unify the tilde expand behavior over several filesystem relative commands. It follows the same rule with glob expansion:
ls ($f | path expand)mkdir,touchcomamnd.Actually I'm not sure for 4th item, currently it's expanding is just because it followes the same rule with glob expansion.
About the change
It changes
expand_path_withto accept a new argument calledexpand_tilde, if it's true, expand it, if not, just keep it as~itself.User-Facing Changes
After this change,
ls "~/aaa"won't expand tilde.Tests + Formatting
Done