open file for writing
Some checks are pending
continuous-integration/drone/push Build is passing

This commit is contained in:
Shimun 2019-03-26 14:27:05 +01:00
parent 25dfa2f5f1
commit 3d2bea74d1

View File

@ -1,11 +1,8 @@
#[macro_use]
extern crate structopt;
use structopt::StructOpt;
mod opts;
use html5ever::serialize::{serialize, SerializeOpts, TraversalScope};
use kuchiki::NodeRef;
use markup5ever::serialize::Serialize as MSerialize;
use opts::Opts;
use std::error::Error;
@ -13,8 +10,6 @@ use std::fs::File;
use std::io;
use std::io::Write;
use std::io::{stdin, stdout, Read};
use std::path::PathBuf;
extern crate kuchiki;
use kuchiki::traits::*;
@ -52,7 +47,7 @@ fn main() -> Result<(), Box<Error>> {
};
let mut out: Box<Write> = if let Some(path) = opt.output {
let file = File::open(&path)?;
let file = File::create(&path)?;
Box::new(file)
} else {
Box::new(stdout())