mirror of
https://github.com/pcvolkmer/fastq-tools.git
synced 2025-09-13 13:12:52 +00:00
refactor: extract decompression
This commit is contained in:
27
src/main.rs
27
src/main.rs
@@ -76,25 +76,16 @@ fn main() {
|
|||||||
_ => Box::new(BufReader::new(std::io::stdin())),
|
_ => Box::new(BufReader::new(std::io::stdin())),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let input: Box<dyn BufRead> = if args.decompress {
|
||||||
|
let gz_decoder = GzDecoder::new(input);
|
||||||
|
Box::new(BufReader::new(gz_decoder))
|
||||||
|
} else {
|
||||||
|
Box::new(input)
|
||||||
|
};
|
||||||
|
|
||||||
match &args.command {
|
match &args.command {
|
||||||
Command::Info => {
|
Command::Info => info(input),
|
||||||
if args.decompress {
|
Command::Scramble => scramble(input),
|
||||||
let gz_decoder = GzDecoder::new(input);
|
|
||||||
let buf_reader = BufReader::new(gz_decoder);
|
|
||||||
info(buf_reader)
|
|
||||||
} else {
|
|
||||||
info(BufReader::new(input))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Command::Scramble => {
|
|
||||||
if args.decompress {
|
|
||||||
let gz_decoder = GzDecoder::new(input);
|
|
||||||
let buf_reader = BufReader::new(gz_decoder);
|
|
||||||
scramble(buf_reader)
|
|
||||||
} else {
|
|
||||||
scramble(BufReader::new(input))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
println!()
|
println!()
|
||||||
|
Reference in New Issue
Block a user