Skip to content

Commit

Permalink
fix(cli): Avoid Unicode direction isolation marks in CLI output
Browse files Browse the repository at this point in the history
For easier copy/paste from terminals...
  • Loading branch information
alerque committed Aug 27, 2024
1 parent 2cdcab8 commit 1b77072
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
21 changes: 4 additions & 17 deletions src/ui_ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@ pub struct AsciiJobStatus {
impl AsciiJobStatus {
fn new(target: MakeTarget) -> Self {
if !CONF.get_bool("passthrough").unwrap() {
// Without this, copying the string in the terminal as a word brings a U+2069 with it
// c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72
let mut printable_target: String = target.to_string();
printable_target.push(' ');
let printable_target = style(printable_target).white().bold();
let printable_target = style(target.to_string()).white().bold();
let msg = LocalText::new("make-report-start")
.arg("target", printable_target)
.fmt();
Expand All @@ -147,7 +143,7 @@ impl JobStatus for AsciiJobStatus {
fn dump(&self) {
if !CONF.get_bool("passthrough").unwrap() {
let start = LocalText::new("make-backlog-start")
.arg("target", self.target.clone())
.arg("target", self.target.to_string())
.fmt();
println!("{}{start}", style("----- ").cyan());
}
Expand All @@ -173,12 +169,7 @@ impl JobStatus for AsciiJobStatus {
if CONF.get_bool("passthrough").unwrap() {
return;
}
// Without this, copying the string in the terminal as a word brings a U+2069 with it
// c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72
let mut printable_target: String = self.target.to_string();
printable_target.push(' ');
let target = printable_target;
let target = style(target).white().bold();
let target = style(self.target.to_string()).white().bold();
let msg = LocalText::new("make-report-pass")
.arg("target", target)
.fmt();
Expand All @@ -189,11 +180,7 @@ impl JobStatus for AsciiJobStatus {
if CONF.get_bool("passthrough").unwrap() {
return;
}
// Without this, copying the string in the terminal as a word brings a U+2069 with it
let mut printable_target: String = self.target.to_string();
printable_target.push(' ');
let target = printable_target;
let target = style(target).white().bold();
let target = style(self.target.to_string()).white().bold();
let msg = LocalText::new("make-report-fail")
.arg("target", target)
.arg("code", code)
Expand Down
12 changes: 4 additions & 8 deletions src/ui_indicatif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,9 @@ impl std::ops::Deref for IndicatifJobStatus {
impl IndicatifJobStatus {
// pub fn new(ui: &IndicatifInterface, mut target: String) -> Self {
pub fn new(subcommand: &IndicatifSubcommandStatus, target: MakeTarget) -> Self {
// Without this, copying the string in the terminal as a word brings a U+2069 with it
// c.f. https://github.com/XAMPPRocky/fluent-templates/issues/72
let mut printable_target: String = target.to_string();
printable_target.push(' ');
let msg = style(
LocalText::new("make-report-start")
.arg("target", style(printable_target).white().bold())
.arg("target", style(target.to_string()).white().bold())
.fmt(),
)
.yellow()
Expand Down Expand Up @@ -282,7 +278,7 @@ impl JobStatus for IndicatifJobStatus {
}
fn dump(&self) {
let start = LocalText::new("make-backlog-start")
.arg("target", self.target.clone())
.arg("target", self.target.to_string())
.fmt();
let start = format!("{} {start}", style(style("┄┄┄┄┄").cyan()));
self.bar.println(start);
Expand All @@ -303,7 +299,7 @@ impl JobStatus for IndicatifJobStatus {
self.bar.println(end);
}
fn pass_msg(&self) {
let target = self.target.clone();
let target = self.target.to_string();
let allow_hide = !CONF.get_bool("debug").unwrap() && !CONF.get_bool("verbose").unwrap();
if allow_hide && target.starts_with(".fontship") {
// UI.remove(&self.bar);
Expand All @@ -322,7 +318,7 @@ impl JobStatus for IndicatifJobStatus {
fn fail_msg(&self, code: u32) {
let msg = style(
LocalText::new("make-report-fail")
.arg("target", style(self.target.clone()).white().bold())
.arg("target", style(self.target.to_string()).white().bold())
.arg("code", style(code).white().bold())
.fmt(),
)
Expand Down

0 comments on commit 1b77072

Please sign in to comment.