Skip to content

Commit

Permalink
Temporarily work around luser/strip-ansi-escapes#20
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyyyylime committed Sep 4, 2024
1 parent 96ff629 commit 0e0167b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ struct Args {
/// The input path. If unset, stdin is used.
input: Option<PathBuf>,

/// Whether the input should be formatted to be Discord-compatible.
#[clap(short, long)]
discord: bool,

/// Wrap the output in a Discord-flavoured-markdown–style ANSI codeblock.
#[clap(short, long, overrides_with = "_no_discord")]
discord: bool,
Expand Down Expand Up @@ -112,7 +108,9 @@ fn main() -> Result<()> {
&input
};

if args.strip_ansi {
// If the input doesn't contain escape sequences, avoid processing it because strip-ansi-escapes
// also strips tabs unfortunately. (https://github.com/luser/strip-ansi-escapes/issues/20)
if args.strip_ansi && stripped.contains('\x1B') {
input = strip_ansi_escapes::strip_str(stripped);
stripped = &input;
}
Expand Down

0 comments on commit 0e0167b

Please sign in to comment.