Skip to content

Commit

Permalink
fix: strip ansi escapes from cli input
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter committed Oct 16, 2024
1 parent b2af7f9 commit 927f323
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ categories = ["command-line-utilities"]
edition = "2021"

[dependencies]
anstream = "0.6.15"
clap = { version = "4.5.9", features = ["derive"] }
clap-stdin = "0.4.0"
color-eyre = "0.6.3"
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use color_eyre::eyre::Result;
use clap::Parser;
use clap_stdin::MaybeStdin;

use anstream::{adapter::strip_str, println};
use crossterm::terminal;

use kittysay::{generate, FormatOptions, KITTY};
Expand Down Expand Up @@ -36,7 +37,7 @@ fn main() -> Result<()> {
width,
};

let msg = generate(&args.message, &format_opts);
let msg = generate(&strip_str(&args.message).to_string(), &format_opts);

let mut msg_color = console::Color::White;
let mut cat_color = console::Color::White;
Expand Down

0 comments on commit 927f323

Please sign in to comment.