this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

style(utils): rename ExtractedTarget variants to CamelCase

FILE/DIRECTORY → File/Directory. Matches Rust's enum variant naming
convention and clippy's screaming_snake_case_ctor lint.

+22 -22
+1 -1
src/backends/bzip2.rs
··· 87 87 88 88 /// Bzip2 extracts to a file by default 89 89 fn default_extracted_target(&self) -> ExtractedTarget { 90 - ExtractedTarget::FILE 90 + ExtractedTarget::File 91 91 } 92 92 93 93 /// Compress an input file or pipe to a bz2 archive
+1 -1
src/backends/gzip.rs
··· 61 61 62 62 /// Gzip extracts to a file by default 63 63 fn default_extracted_target(&self) -> ExtractedTarget { 64 - ExtractedTarget::FILE 64 + ExtractedTarget::File 65 65 } 66 66 67 67 /// Compress an input file or pipe to a gzip archive
+2 -2
src/backends/pipeline.rs
··· 178 178 } 179 179 180 180 fn default_extracted_filename(&self, in_path: &Path) -> String { 181 - if self.default_extracted_target() == ExtractedTarget::DIRECTORY { 181 + if self.default_extracted_target() == ExtractedTarget::Directory { 182 182 return ".".to_string(); 183 183 } 184 184 // Strip all known extensions: input.tar.gz → input ··· 299 299 300 300 let final_output = match output { 301 301 CmprssOutput::Path(ref p) => { 302 - if last_extractor.default_extracted_target() == ExtractedTarget::DIRECTORY 302 + if last_extractor.default_extracted_target() == ExtractedTarget::Directory 303 303 && !p.exists() 304 304 { 305 305 std::fs::create_dir_all(p)?;
+1 -1
src/backends/tar.rs
··· 32 32 33 33 /// Tar extracts to a directory by default 34 34 fn default_extracted_target(&self) -> ExtractedTarget { 35 - ExtractedTarget::DIRECTORY 35 + ExtractedTarget::Directory 36 36 } 37 37 38 38 fn compress(&self, input: CmprssInput, output: CmprssOutput) -> Result {
+1 -1
src/backends/zip.rs
··· 66 66 67 67 /// Zip extracts to a directory by default 68 68 fn default_extracted_target(&self) -> ExtractedTarget { 69 - ExtractedTarget::DIRECTORY 69 + ExtractedTarget::Directory 70 70 } 71 71 72 72 fn compress(&self, input: CmprssInput, output: CmprssOutput) -> Result {
+4 -4
src/main.rs
··· 604 604 let c = get_compressor_from_filename(Path::new(path)).unwrap(); 605 605 assert_eq!( 606 606 c.default_extracted_target(), 607 - ExtractedTarget::DIRECTORY, 607 + ExtractedTarget::Directory, 608 608 "{path} should extract to a directory", 609 609 ); 610 610 } ··· 662 662 #[test] 663 663 fn test_extracted_target_single_pipeline() { 664 664 let gz = get_compressor_from_filename(Path::new("file.gz")).unwrap(); 665 - assert_eq!(gz.default_extracted_target(), ExtractedTarget::FILE); 665 + assert_eq!(gz.default_extracted_target(), ExtractedTarget::File); 666 666 667 667 let tar = get_compressor_from_filename(Path::new("file.tar")).unwrap(); 668 - assert_eq!(tar.default_extracted_target(), ExtractedTarget::DIRECTORY); 668 + assert_eq!(tar.default_extracted_target(), ExtractedTarget::Directory); 669 669 } 670 670 671 671 #[test] 672 672 fn test_extracted_target_multi_pipeline() { 673 673 // tar.gz: innermost is tar, which extracts to directory 674 674 let c = get_compressor_from_filename(Path::new("archive.tar.gz")).unwrap(); 675 - assert_eq!(c.default_extracted_target(), ExtractedTarget::DIRECTORY); 675 + assert_eq!(c.default_extracted_target(), ExtractedTarget::Directory); 676 676 } 677 677 678 678 #[test]
+8 -8
src/test_utils.rs
··· 41 41 let formatted_name = format!("test.{}", ext); 42 42 let archive_path = Path::new(&formatted_name); 43 43 match compressor.default_extracted_target() { 44 - ExtractedTarget::FILE => { 44 + ExtractedTarget::File => { 45 45 assert_eq!(compressor.default_extracted_filename(archive_path), "test"); 46 46 } 47 - ExtractedTarget::DIRECTORY => { 47 + ExtractedTarget::Directory => { 48 48 assert_eq!(compressor.default_extracted_filename(archive_path), "."); 49 49 } 50 50 } ··· 52 52 // Test default_extracted_filename with non-matching extension 53 53 let non_archive_path = Path::new("test.txt"); 54 54 match compressor.default_extracted_target() { 55 - ExtractedTarget::FILE => { 55 + ExtractedTarget::File => { 56 56 assert_eq!( 57 57 compressor.default_extracted_filename(non_archive_path), 58 58 "archive" 59 59 ); 60 60 } 61 - ExtractedTarget::DIRECTORY => { 61 + ExtractedTarget::Directory => { 62 62 assert_eq!(compressor.default_extracted_filename(non_archive_path), "."); 63 63 } 64 64 } ··· 83 83 84 84 // Extract 85 85 let output_path = match compressor.default_extracted_target() { 86 - ExtractedTarget::FILE => temp_dir.path().join("output.txt"), 87 - ExtractedTarget::DIRECTORY => temp_dir.path().join("output"), 86 + ExtractedTarget::File => temp_dir.path().join("output.txt"), 87 + ExtractedTarget::Directory => temp_dir.path().join("output"), 88 88 }; 89 89 compressor.extract( 90 90 CmprssInput::Path(vec![archive_path]), ··· 94 94 // Verify 95 95 let input_filename = "input.txt"; 96 96 let output_data = match compressor.default_extracted_target() { 97 - ExtractedTarget::FILE => fs::read_to_string(output_path)?, 98 - ExtractedTarget::DIRECTORY => fs::read_to_string(output_path.join(input_filename))?, 97 + ExtractedTarget::File => fs::read_to_string(output_path)?, 98 + ExtractedTarget::Directory => fs::read_to_string(output_path.join(input_filename))?, 99 99 }; 100 100 assert_eq!(output_data, test_data); 101 101
+4 -4
src/utils.rs
··· 12 12 #[derive(Debug, Clone, Copy, PartialEq, Eq)] 13 13 pub enum ExtractedTarget { 14 14 /// Extract to a single file (e.g., gzip, bzip2, xz) 15 - FILE, 15 + File, 16 16 /// Extract to a directory (e.g., zip, tar) 17 - DIRECTORY, 17 + Directory, 18 18 } 19 19 20 20 #[derive(Args, Debug)] ··· 170 170 /// FILE compressors (like gzip, bzip2, xz) extract to a single file 171 171 /// DIRECTORY compressors (like zip, tar) extract to a directory 172 172 fn default_extracted_target(&self) -> ExtractedTarget { 173 - ExtractedTarget::FILE 173 + ExtractedTarget::File 174 174 } 175 175 176 176 /// Detect if the input is an archive of this type ··· 198 198 199 199 /// Generate the default extracted filename 200 200 fn default_extracted_filename(&self, in_path: &Path) -> String { 201 - if self.default_extracted_target() == ExtractedTarget::DIRECTORY { 201 + if self.default_extracted_target() == ExtractedTarget::Directory { 202 202 return ".".to_string(); 203 203 } 204 204