-
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
make cd
, cp
, ls
, mv
, open
and rm
automatically strip ansi codes
#6220
Conversation
Thanks @merelymyself! The core-team needs to discuss this more, so I'm going to make this a draft until we have a decision. Also, I'm not a fan of having The way I see it there are a few options here.
|
I'd vote for option 2 because I don't see much use in keeping ANSI codes in filesystem commands. My take on this in general (not necessarily for this PR): Also, we should expand this in all commands that would get screwed by ANSI codes. For example, On the other hand |
@merelymyself thanks for the clarification but I'm sorry I still don't understand the |
Because
Note that this errors if ansi codes are not stripped:
|
Ah, yeah, so the |
Ah, as input. Thanks. I see your point now. Seems like kubouch and I are in agreement in supporting number 2. |
@merelymyself could you go ahead and implement number 2 above, i.e. remove the --include-ansi flag? |
here's hoping we never see this edge case. thanks! |
…rip ansi codes (nushell#6220)" This reverts commit 3b809b3.
I should mention that, this isn't only about escapes. Every one of the non-printable characters should be treated as the same, as they are valid parts of a file name |
Description
Following the discussion in discord over interaction of these filesystem commands with
find
, which highlights the matching portions, this PR makes filesystem commands automatically strip the ansi codes from the input. Because some filesystems allow ansi codes to be part of the filename, this PR also adds a switch to allow these commands to work like they used to.Tests
Make sure you've done the following:
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --check
to check standard code formatting (cargo fmt --all
applies these changes)cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect
to check that you're using the standard code stylecargo test --workspace --features=extra
to check that all the tests pass