Allow use of stdin (piping) for input file.
This commit is contained in:
@@ -40,8 +40,13 @@ fn main() -> io::Result<()> {
|
|||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut in_reader:Box<dyn io::Read>;
|
||||||
|
if args[1] == "-" {
|
||||||
|
in_reader = Box::new(io::stdin());
|
||||||
|
} else {
|
||||||
let in_file = fs::File::open(&args[1])?;
|
let in_file = fs::File::open(&args[1])?;
|
||||||
let mut in_reader = io::BufReader::new(in_file);
|
in_reader = Box::new(io::BufReader::new(in_file));
|
||||||
|
}
|
||||||
|
|
||||||
let mut out_writer:Box<dyn io::Write>;
|
let mut out_writer:Box<dyn io::Write>;
|
||||||
if args.len() == 3 {
|
if args.len() == 3 {
|
||||||
|
Reference in New Issue
Block a user