-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ls/rm/cd strip ansi escapes #6315
Comments
seems like an edge case where people would actually name files using ansi escapes. we talked about this when we decided to strip them for file move operations. maybe there should be some string literal way to remove files when mistakes like this happen? |
What is the usecase for automatically stripping escapes from a path? It seems to me like that is more of an edgecase. Especially considering that there is already a mechanism to strip escapes explicitly if you really need to via |
Ok, I see what the original reason in #6220 was regarding => |
Maybe we could extend the nushell/crates/nu-protocol/src/pipeline_data.rs Lines 51 to 59 in 72c27bd
While I'd love to see a more generic approach to modify the rendering of the table without having to hardcode specific commands, adding |
We could strip ansi sequences for |
The use case for stripping ansi sequences is if you want to do something like |
I'm always open to a PR with a better solution. |
Already working on it! |
No worries. I'm glad you're finding and fixing these. It was a real pain to make find highlight things. |
#6324 should lay the groundwork for fixing this issue. |
Boosting this one as something that we should probably resolve in a principled way before 1.0 . The current behavior of manipulating the data to deal with how Nushell should allow you to compose data pipelines reliably. And if we partially made that work for See also #6220 (comment) |
Previously all our file system operations tried to remove ANSI escape codes from their input (as well as other characters like `\t`). - This is bad if you want to deal with files that are allowed arbitrary names in the bounds of the OS/FS - This was done as we had `ls` inserting colors before we had the working `PipelineMetadata` system. - Currently `find` will still insert ANSI coloring into its result and messing with downstream commands (see nushell#11899) Closes nushell#6315
Describe the bug
ls, rm, cd and possibly other tools strip ansi escapes, rendering some file operations impossible or resulting in surprising and dangerous behaviour.
How to reproduce
touch $"(ansi red)hello"
rm touch $"(ansi red)hello"
Expected behavior
I expect core filesystem commands to do as I say.
Screenshots
Configuration
Additional context
No response
The text was updated successfully, but these errors were encountered: