@@ -18,7 +18,7 @@ use std::{
1818
1919/// Create a cache from parsed CODEOWNERS entries and files
2020pub fn build_cache (
21- entries : Vec < CodeownersEntry > , files : Vec < PathBuf > , hash : [ u8 ; 32 ] ,
21+ entries : Vec < CodeownersEntry > , files : Vec < PathBuf > , hash : [ u8 ; 32 ] , quiet : bool ,
2222) -> Result < CodeownersCache > {
2323 let mut owners_map = std:: collections:: HashMap :: new ( ) ;
2424 let mut tags_map = std:: collections:: HashMap :: new ( ) ;
@@ -42,18 +42,20 @@ pub fn build_cache(
4242 processed_count. fetch_add ( 1 , std:: sync:: atomic:: Ordering :: Relaxed ) + 1 ;
4343
4444 // Limit filename display length and clear the line properly
45- let file_display = file_path. display ( ) . to_string ( ) ;
46- let truncated_file = if file_display. len ( ) > 60 {
47- format ! ( "...{}" , & file_display[ file_display. len( ) - 57 ..] )
48- } else {
49- file_display
50- } ;
51-
52- print ! (
53- "\r \x1b [K📁 Processing [{}/{}] {}" ,
54- current, total_files, truncated_file
55- ) ;
56- std:: io:: stdout ( ) . flush ( ) . unwrap ( ) ;
45+ if !quiet {
46+ let file_display = file_path. display ( ) . to_string ( ) ;
47+ let truncated_file = if file_display. len ( ) > 60 {
48+ format ! ( "...{}" , & file_display[ file_display. len( ) - 57 ..] )
49+ } else {
50+ file_display
51+ } ;
52+
53+ print ! (
54+ "\r \x1b [K📁 Processing [{}/{}] {}" ,
55+ current, total_files, truncated_file
56+ ) ;
57+ std:: io:: stdout ( ) . flush ( ) . unwrap ( ) ;
58+ }
5759
5860 let ( owners, tags) =
5961 find_owners_and_tags_for_file ( file_path, & matched_entries) . unwrap ( ) ;
@@ -70,7 +72,9 @@ pub fn build_cache(
7072 . collect ( ) ;
7173
7274 // Print newline after processing is complete
73- println ! ( "\r \x1b [K✅ Processed {} files successfully" , total_files) ;
75+ if !quiet {
76+ println ! ( "\r \x1b [K✅ Processed {} files successfully" , total_files) ;
77+ }
7478
7579 // Process each owner
7680 let owners = collect_owners ( & entries) ;
@@ -175,7 +179,7 @@ pub fn load_cache(path: &Path) -> Result<CodeownersCache> {
175179}
176180
177181pub fn sync_cache (
178- repo : & std:: path:: Path , cache_file : Option < & std:: path:: Path > ,
182+ repo : & std:: path:: Path , cache_file : Option < & std:: path:: Path > , quiet : bool ,
179183) -> Result < CodeownersCache > {
180184 let config_cache_file = crate :: utils:: app_config:: AppConfig :: fetch ( ) ?
181185 . cache_file
@@ -189,7 +193,7 @@ pub fn sync_cache(
189193 // Verify that the cache file exists
190194 if !repo. join ( cache_file) . exists ( ) {
191195 // parse the codeowners files and build the cache
192- return parse_repo ( & repo, & cache_file) ;
196+ return parse_repo ( & repo, & cache_file, quiet ) ;
193197 }
194198
195199 // Load the cache from the specified file
@@ -207,7 +211,7 @@ pub fn sync_cache(
207211
208212 if cache_hash != current_hash {
209213 // parse the codeowners files and build the cache
210- return parse_repo ( & repo, & cache_file) ;
214+ return parse_repo ( & repo, & cache_file, quiet ) ;
211215 } else {
212216 return Ok ( cache) ;
213217 }
0 commit comments