@@ -10,12 +10,12 @@ pub struct MissingBlobs {
10
10
}
11
11
12
12
impl MissingBlobs {
13
- /// Creates a new MissingBlobs with the given configuration .
14
- pub fn new ( recursive : bool ) -> Self {
15
- Self { recursive }
13
+ /// Creates a new MissingBlobs builder .
14
+ pub fn builder ( ) -> MissingBlobsBuilder {
15
+ MissingBlobsBuilder :: default ( )
16
16
}
17
17
18
- /// Searches for blobs in given paths, and display missing dependencies.
18
+ /// Searches for blobs in the given paths, and displays missing dependencies.
19
19
pub fn run ( & self , paths : & [ & str ] ) {
20
20
let file_paths: Vec < PathBuf > = if self . recursive {
21
21
find_files_recursively ( & paths)
@@ -38,6 +38,32 @@ impl MissingBlobs {
38
38
}
39
39
}
40
40
41
+ /// The MissingBlobs builder.
42
+ pub struct MissingBlobsBuilder {
43
+ recursive : bool ,
44
+ }
45
+
46
+ impl Default for MissingBlobsBuilder {
47
+ fn default ( ) -> Self {
48
+ Self { recursive : false }
49
+ }
50
+ }
51
+
52
+ impl MissingBlobsBuilder {
53
+ /// Builds a MissingBlobs.
54
+ pub fn build ( & self ) -> MissingBlobs {
55
+ MissingBlobs {
56
+ recursive : self . recursive ,
57
+ }
58
+ }
59
+
60
+ /// Sets whether to search paths recursively.
61
+ pub fn recursive ( mut self , enable : bool ) -> Self {
62
+ self . recursive = enable;
63
+ self
64
+ }
65
+ }
66
+
41
67
fn find_files ( paths : & [ & str ] ) -> Vec < PathBuf > {
42
68
let dirs = paths
43
69
. iter ( )
0 commit comments