diff --git a/Cargo.lock b/Cargo.lock index 1ff9ea9..e0e1bd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -531,6 +531,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index e7089c1..e30c807 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,10 @@ lazy_static = "1.4.0" regex = "1.3.1" url = "2.1.0" +# Used to render comments indicating the time the page was saved +# also required by reqwest as of v0.10.0 +time = "0.1.42" + [dependencies.reqwest] version = "0.10.*" default-features = false diff --git a/src/main.rs b/src/main.rs index 54c267c..4141390 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,6 +71,7 @@ fn main() { app_args.silent, ) .unwrap(); + let downloaded_time = time::now(); let dom = html_to_dom(&data); walk_and_embed_assets( @@ -85,7 +86,7 @@ fn main() { app_args.no_frames, ); - let html: String = stringify_document( + let mut html: String = stringify_document( &dom.document, app_args.no_css, app_args.no_frames, @@ -94,6 +95,17 @@ fn main() { app_args.isolate, ); + html.insert_str( + 0, + &format!( + "\n", + &final_url, + downloaded_time.to_local().rfc822(), + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION"), + ), + ); + if app_args.output == str!() { println!("{}", html); } else {