@@ -2,7 +2,7 @@ use std::{
2
2
collections:: HashMap ,
3
3
io:: BufRead ,
4
4
path:: { Path , PathBuf } ,
5
- process:: { exit , Command } ,
5
+ process:: { Command , exit } ,
6
6
} ;
7
7
8
8
use anyhow:: { Context , Result } ;
@@ -68,12 +68,12 @@ fn main() -> Result<()> {
68
68
) ;
69
69
}
70
70
71
- let mut map: HashMap < String , String > = HashMap :: new ( ) ;
71
+ let mut map: HashMap < String , Vec < String > > = HashMap :: new ( ) ;
72
72
73
73
for dep in deps {
74
74
searcher:: search ( "/var/lib/apt/lists" , Mode :: Provides , & dep, |( pkg, path) | {
75
75
if path. ends_with ( & format ! ( "/{}" , dep) ) {
76
- map. insert ( pkg, path) ;
76
+ map. entry ( pkg) . or_default ( ) . push ( path) ;
77
77
}
78
78
} )
79
79
. ok ( ) ;
@@ -87,13 +87,14 @@ fn main() -> Result<()> {
87
87
. filter ( |x| !optenv32 || x. 0 . ends_with ( "+32" ) )
88
88
. filter ( |x| {
89
89
( all_prefix || optenv32)
90
- || Path :: new ( & x. 1 )
91
- . parent ( )
92
- . is_some_and ( |x| x. to_string_lossy ( ) == "/usr/lib" )
90
+ || x. 1 . iter ( ) . map ( |p| Path :: new ( p) ) . any ( |x| {
91
+ x. parent ( )
92
+ . is_some_and ( |x| x. to_string_lossy ( ) == "/usr/lib" )
93
+ } )
93
94
} )
94
95
. for_each ( |x| {
95
96
if print_paths {
96
- println ! ( "{} ({}) " , x. 0 , x. 1 )
97
+ println ! ( "{} [{}] " , x. 0 , x. 1 . join ( "," ) )
97
98
} else if oneline {
98
99
print ! ( "{} " , x. 0 ) ;
99
100
} else {
0 commit comments