MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / strip_ansi

Function strip_ansi

atomic-cli/tests/it/status_git_cb11a_test.rs:194–209  ·  view source on GitHub ↗
(text: &str)

Source from the content-addressed store, hash-verified

192}
193
194fn strip_ansi(text: &str) -> String {
195 let mut output = String::with_capacity(text.len());
196 let mut chars = text.chars();
197 while let Some(c) = chars.next() {
198 if c == '\x1b' {
199 for escape in chars.by_ref() {
200 if escape == 'm' {
201 break;
202 }
203 }
204 } else {
205 output.push(c);
206 }
207 }
208 output
209}
210
211fn output_text(output: &Output) -> String {
212 format!(

Calls 3

lenMethod · 0.45
nextMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected