@@ -4,29 +4,35 @@ use std::collections::HashMap;
4
4
use std:: fs;
5
5
use std:: path:: { Path , PathBuf } ;
6
6
7
- pub struct Config {
8
- pub recursive : bool ,
7
+ pub struct MissingBlobs {
8
+ recursive : bool ,
9
9
}
10
10
11
- pub fn run ( paths : & [ & str ] , config : Config ) {
12
- let file_paths: Vec < PathBuf > = if config. recursive {
13
- find_files_recursively ( & paths)
14
- } else {
15
- find_files ( & paths)
16
- } ;
17
-
18
- let blob_paths: Vec < & PathBuf > = file_paths
19
- . iter ( )
20
- . filter ( |path| match path. extension ( ) {
21
- // Assume that valid blobs have ".so" extension.
22
- Some ( ext) => ext == "so" ,
23
- None => false ,
24
- } )
25
- . collect ( ) ;
11
+ impl MissingBlobs {
12
+ pub fn new ( recursive : bool ) -> Self {
13
+ Self { recursive }
14
+ }
26
15
27
- let blobs_to_dependencies = get_dependencies ( & blob_paths) ;
28
- let missing_blobs = identify_missing ( & blobs_to_dependencies) ;
29
- display_missing_blobs ( & missing_blobs) ;
16
+ pub fn run ( & self , paths : & [ & str ] ) {
17
+ let file_paths: Vec < PathBuf > = if self . recursive {
18
+ find_files_recursively ( & paths)
19
+ } else {
20
+ find_files ( & paths)
21
+ } ;
22
+
23
+ let blob_paths: Vec < & PathBuf > = file_paths
24
+ . iter ( )
25
+ . filter ( |path| match path. extension ( ) {
26
+ // Assume that valid blobs have ".so" extension.
27
+ Some ( ext) => ext == "so" ,
28
+ None => false ,
29
+ } )
30
+ . collect ( ) ;
31
+
32
+ let blobs_to_dependencies = get_dependencies ( & blob_paths) ;
33
+ let missing_blobs = identify_missing ( & blobs_to_dependencies) ;
34
+ display_missing_blobs ( & missing_blobs) ;
35
+ }
30
36
}
31
37
32
38
fn find_files ( paths : & [ & str ] ) -> Vec < PathBuf > {
0 commit comments