From 4a4b17a36d35f17a83a59d0aa4373da5131e64e2 Mon Sep 17 00:00:00 2001 From: Jaakko Ruohio Date: Sun, 9 Jul 2023 00:00:18 +0300 Subject: [PATCH] Human sort channel list --- Cargo.toml | 1 + src/command_list.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9f100d67..00329c07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,7 @@ bstr = "1.0.1" indoc = "2.0.1" is-terminal = "0.4.7" path-absolutize = "3" +human-sort = "0.2.2" [target.'cfg(windows)'.dependencies] windows = { version = "0.48.0", features = ["Win32_Foundation", "Win32_UI_Shell", "Win32_System_Console", "Services_Store", "Foundation", "Foundation_Collections", "Web_Http", "Storage_Streams",] } diff --git a/src/command_list.rs b/src/command_list.rs index 7479a1a8..aa49493e 100644 --- a/src/command_list.rs +++ b/src/command_list.rs @@ -5,6 +5,7 @@ use cli_table::{ print_stdout, ColorChoice, Table, WithTitle, }; use itertools::Itertools; +use human_sort::compare; #[derive(Table)] struct ChannelRow { @@ -27,7 +28,7 @@ pub fn run_command_list(paths: &GlobalPaths) -> Result<()> { version: i.1.version.clone(), } }) - .sorted_by_key(|i| i.name.clone()) + .sorted_by(|a, b| compare(&a.name, &b.name)) .collect(); print_stdout(