Skip to content
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

str-expand: Add Escaping Example #9841

Merged
merged 2 commits into from Jul 31, 2023
Merged

str-expand: Add Escaping Example #9841

merged 2 commits into from Jul 31, 2023

Conversation

atahabaki
Copy link
Contributor

Related Issue: #9838

Adds an example, how bracoxide/str-expand handles the escaping char \.

@atahabaki atahabaki changed the title str-expand: update examples, add escaping example str-expand: Add Escaping Example Jul 28, 2023
@fdncred
Copy link
Collaborator

fdncred commented Jul 28, 2023

Thanks for this. It's helpful to understand. However, when constructing paths with path join, I'm not sure how to make it work.

@atahabaki
Copy link
Contributor Author

atahabaki commented Jul 28, 2023

Thanks for this. It's helpful to understand. However, when constructing paths with path join, I'm not sure how to make it work.

On Windows, it's absolutely necessary to add this before the str-expand

| str replace '\\' '\\\\' | str expand

I don't have an idea in this implementation, as I'm mentioned in this comment: #9838 (comment)

I mean, should I skip what's came after the \ in all cases? Or should I skip only the valid characters (such as braces, dots, and commas (the special characters of the brace expansion))?

@fdncred
Copy link
Collaborator

fdncred commented Jul 28, 2023

You need to convince Microsoft to change their \ to /. That's all! 🤣

I'm thinking that path join --escape may be helpful, but I'm not quite sure.

@fdncred
Copy link
Collaborator

fdncred commented Jul 31, 2023

I think this is good since it just shows another example. Thanks!

@fdncred fdncred merged commit e16ce1d into nushell:main Jul 31, 2023
19 checks passed
@atahabaki atahabaki deleted the str-expand-escaping-example branch August 2, 2023 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants