From 733288e58416a7b9337952bf41e0d4a0f8888877 Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Sat, 25 Nov 2023 11:15:45 +0800 Subject: [PATCH] fix: sort scripts and display in normal text --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 66afadf..7d35e98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -144,9 +144,13 @@ impl Cli { .map(|raw| serde_json::from_str::(&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::>(); + 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}"); } } }