Skip to content

Commit

Permalink
Increase --list maximum alignable width from 30 to 50 (#2039)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored May 15, 2024
1 parent e2c9405 commit c796a25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/subcommand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ impl Subcommand {
}

fn list(config: &Config, level: usize, justfile: &Justfile) {
const MAX_WIDTH: usize = 50;

// Construct a target to alias map.
let mut recipe_aliases: BTreeMap<&str, Vec<&str>> = BTreeMap::new();
if !config.no_aliases {
Expand Down Expand Up @@ -460,13 +462,13 @@ impl Subcommand {
);
}

if line_width <= 30 {
if line_width <= MAX_WIDTH {
line_widths.insert(name, line_width);
}
}
}

let max_line_width = cmp::min(line_widths.values().copied().max().unwrap_or(0), 30);
let max_line_width = cmp::min(line_widths.values().copied().max().unwrap_or(0), MAX_WIDTH);
let doc_color = config.color.stdout().doc();

if level == 0 {
Expand Down
4 changes: 2 additions & 2 deletions tests/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ x a b='B ' c='C':
echo {{a}} {{b}} {{c}}
# something else
this-recipe-is-very-very-very-important Z="\t z":
this-recipe-is-very-very-very-very-very-very-very-very-important Z="\t z":
# this recipe will not appear
_private-recipe:
Expand All @@ -911,7 +911,7 @@ _private-recipe:
stdout: r#"
Available recipes:
hello a b='B ' c='C' # this does a thing
this-recipe-is-very-very-very-important Z="\t z" # something else
this-recipe-is-very-very-very-very-very-very-very-very-important Z="\t z" # something else
x a b='B ' c='C' # this does another thing
"#,
}
Expand Down

0 comments on commit c796a25

Please sign in to comment.