Increase --list maximum alignable width from 30 to 50 (#2039)

This commit is contained in:
Casey Rodarmor 2024-05-14 19:37:00 -07:00 committed by GitHub
parent e2c9405fa9
commit c796a253af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -427,6 +427,8 @@ impl Subcommand {
} }
fn list(config: &Config, level: usize, justfile: &Justfile) { fn list(config: &Config, level: usize, justfile: &Justfile) {
const MAX_WIDTH: usize = 50;
// Construct a target to alias map. // Construct a target to alias map.
let mut recipe_aliases: BTreeMap<&str, Vec<&str>> = BTreeMap::new(); let mut recipe_aliases: BTreeMap<&str, Vec<&str>> = BTreeMap::new();
if !config.no_aliases { if !config.no_aliases {
@ -460,13 +462,13 @@ impl Subcommand {
); );
} }
if line_width <= 30 { if line_width <= MAX_WIDTH {
line_widths.insert(name, line_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(); let doc_color = config.color.stdout().doc();
if level == 0 { if level == 0 {

View File

@ -902,7 +902,7 @@ x a b='B ' c='C':
echo {{a}} {{b}} {{c}} echo {{a}} {{b}} {{c}}
# something else # 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 # this recipe will not appear
_private-recipe: _private-recipe:
@ -911,7 +911,7 @@ _private-recipe:
stdout: r#" stdout: r#"
Available recipes: Available recipes:
hello a b='B ' c='C' # this does a thing 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 x a b='B ' c='C' # this does another thing
"#, "#,
} }