Skip to content

Commit

Permalink
fix: sort scripts and display in normal text
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Nov 25, 2023
1 parent 93bebed commit 733288e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ impl Cli {
.map(|raw| serde_json::from_str::<PackageJson>(&raw))
{
eprint!("{}", make_package_prefix(&package_data));
for (script_name, script_content) in &package_data.scripts {

let mut all_scripts = package_data.scripts.iter().collect::<Vec<_>>();
all_scripts.sort_by_key(|s| s.0);

for (script_name, script_content) in &all_scripts {
println!("{}", script_name.cyan());
println!(" {}", script_content.dimmed());
println!(" {script_content}");
}
}
}
Expand Down

0 comments on commit 733288e

Please sign in to comment.