Skip to content

Commit

Permalink
fix(task): handle carriage return in task description (#27099)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju authored Nov 27, 2024
1 parent e2f7e03 commit 4700f12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/tools/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ fn print_available_tasks(
)?;
if let Some(description) = &desc.task.description {
let slash_slash = colors::italic_gray("//");
for line in description.split('\n') {
for line in description.lines() {
writeln!(writer, " {slash_slash} {}", colors::italic_gray(line))?;
}
}
Expand Down
4 changes: 4 additions & 0 deletions tests/specs/task/description/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"multiline_description": {
"description": "This is a multiline\ndescription",
"command": "echo 2"
},
"multiline_description_carriage_return": {
"description": "This is a multiline\r\ndescription\r\n",
"command": "echo 3"
}
}
}
4 changes: 4 additions & 0 deletions tests/specs/task/description/main.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Available tasks:
// This is a multiline
// description
echo 2
- multiline_description_carriage_return
// This is a multiline
// description
echo 3

0 comments on commit 4700f12

Please sign in to comment.