diff options
| author | rorka900 <rorka900@gmail.com> | 2026-04-06 21:05:06 +0300 |
|---|---|---|
| committer | rorka900 <rorka900@gmail.com> | 2026-04-06 21:05:06 +0300 |
| commit | 62d9463b3f24516158e9e73cd20ccebfc9eec329 (patch) | |
| tree | 664ee2433618df788e9a3db3118a609329ca6e8d /src/group.rs | |
| parent | 044d414f07b13bfdee5a04bc2484510ecfe0a0f8 (diff) | |
| download | ror-62d9463b3f24516158e9e73cd20ccebfc9eec329.tar.gz ror-62d9463b3f24516158e9e73cd20ccebfc9eec329.zip | |
feat: add sror package type, gpg repo verification, and group command
Diffstat (limited to 'src/group.rs')
| -rw-r--r-- | src/group.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/group.rs b/src/group.rs index edabcc6..a349d62 100644 --- a/src/group.rs +++ b/src/group.rs @@ -75,13 +75,18 @@ pub fn list_groups() { println!("{} Available package groups:", "[ror]".blue().bold()); if let Ok(entries) = std::fs::read_dir(groups_dir) { - for entry in entries.flatten() { - if let Some(name) = entry.file_name().to_str() { - if name.ends_with(".yaml") { - let group_name = name.trim_end_matches(".yaml"); - println!(" {}", group_name.green()); - } - } + let mut groups: Vec<String> = entries.flatten() + .filter_map(|e| e.file_name().to_str().map(|s| s.to_string())) + .filter(|n| n.ends_with(".yaml")) + .map(|n| n.trim_end_matches(".yaml").to_string()) + .collect(); + groups.sort(); + for (i, group_name) in groups.iter().enumerate() { + println!( + " {} {}", + format!("[{}]", i + 1).cyan().bold(), + group_name.green() + ); } } } |