Skip to content

Commit

Permalink
tune xtask help output
Browse files Browse the repository at this point in the history
  • Loading branch information
busticated committed Nov 26, 2023
1 parent df015f3 commit 9b8ad31
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions xtask/src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,16 @@ impl Tasks {
for task in self.map.values() {
let char_count = task.name.char_indices().count();
let spaces = separator.repeat(max_col_width - char_count + padding);
let line = format!(">> {}{}{}\n", task.name, spaces, task.description);
let line = format!(" {}{}{}\n", task.name, spaces, task.description);

lines.push_str(&line);

for (name, description) in task.flags.iter() {
let separator = " ".to_string();
let spaces = separator.repeat(max_col_width + padding);
let line = format!("\n{} >> --{} | {}\n", spaces, name, description);
let line = format!("{} --{} | {}\n", spaces, name, description);
lines.push_str(&line);
}

lines.push('\n');
}

Ok(lines)
Expand Down Expand Up @@ -192,16 +190,11 @@ mod tests {
assert_eq!(
tasks.help().unwrap(),
[
">> one....task 01",
"",
" >> --bar | enables bar",
"",
" >> --foo | does the foo",
"",
">> two....task 02",
"",
" >> --baz | invokes a baz",
"",
" one....task 01",
" ⮑ --bar | enables bar",
" ⮑ --foo | does the foo",
" two....task 02",
" ⮑ --baz | invokes a baz",
"",
]
.join("\n")
Expand Down

0 comments on commit 9b8ad31

Please sign in to comment.