1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00

fix(task): handle carriage return in task description (#27099)

Ref https://github.com/denoland/deno/pull/27069#discussion_r1857702814
This commit is contained in:
Bartek Iwańczuk 2024-11-27 01:12:47 +00:00 committed by GitHub
parent e2f7e031b3
commit 4700f12ddc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View file

@ -721,7 +721,7 @@ fn print_available_tasks(
)?; )?;
if let Some(description) = &desc.task.description { if let Some(description) = &desc.task.description {
let slash_slash = colors::italic_gray("//"); 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))?; writeln!(writer, " {slash_slash} {}", colors::italic_gray(line))?;
} }
} }

View file

@ -7,6 +7,10 @@
"multiline_description": { "multiline_description": {
"description": "This is a multiline\ndescription", "description": "This is a multiline\ndescription",
"command": "echo 2" "command": "echo 2"
},
"multiline_description_carriage_return": {
"description": "This is a multiline\r\ndescription\r\n",
"command": "echo 3"
} }
} }
} }

View file

@ -6,3 +6,7 @@ Available tasks:
// This is a multiline // This is a multiline
// description // description
echo 2 echo 2
- multiline_description_carriage_return
// This is a multiline
// description
echo 3