use std::env;
use std::io;
use std::process::exit;
use mzdata::io::{infer_format, infer_from_stream, PreBufferedStream};
fn main() -> io::Result<()> {
let input = env::args().nth(1).unwrap_or_else(|| {
eprintln!("Please provide a file path or '-' for STDIN");
exit(1)
});
let (inferred, gzipped) = if input == "-" {
let mut stream = PreBufferedStream::new(io::stdin())?;
infer_from_stream(&mut stream)?
} else {
infer_format(input)?
};
println!("{:?} (gzip: {})", inferred, gzipped);
Ok(())
}