source-listing example sorts by version
This commit is contained in:
parent
77918dcee7
commit
f8d5c5370b
@ -36,11 +36,11 @@ fn main() {
|
|||||||
let archive_filter = env::args().nth(1);
|
let archive_filter = env::args().nth(1);
|
||||||
|
|
||||||
let mut cache = Cache::get_singleton();
|
let mut cache = Cache::get_singleton();
|
||||||
|
let mut source_versions = HashMap::new();
|
||||||
|
{
|
||||||
let mut all_packages = cache.iter();
|
let mut all_packages = cache.iter();
|
||||||
|
|
||||||
let mut source_versions = HashMap::new();
|
|
||||||
while let Some(binary) = all_packages.next() {
|
while let Some(binary) = all_packages.next() {
|
||||||
|
|
||||||
let mut binary_versions = binary.versions();
|
let mut binary_versions = binary.versions();
|
||||||
while let Some(version) = binary_versions.next() {
|
while let Some(version) = binary_versions.next() {
|
||||||
if let Some(ref target_archive) = archive_filter {
|
if let Some(ref target_archive) = archive_filter {
|
||||||
@ -59,9 +59,12 @@ fn main() {
|
|||||||
.insert(version.source_version());
|
.insert(version.source_version());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for src in lexicographic_sort(source_versions.keys()) {
|
for src in lexicographic_sort(source_versions.keys()) {
|
||||||
for ver in lexicographic_sort(source_versions[src].iter()) {
|
let mut sorted_versions: Vec<&String> = source_versions[src].iter().collect();
|
||||||
|
sorted_versions.sort_by(|left, right| cache.compare_versions(left, right));
|
||||||
|
for ver in sorted_versions {
|
||||||
println!("{}={}", src, ver);
|
println!("{}={}", src, ver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user