Added comment indicating the context under which the page was downloaded

pull/100/head
Emi Simpson 4 years ago
parent 929512f4f5
commit 27c9fb4cd3
No known key found for this signature in database
GPG Key ID: 68FAB2E2E6DFC98B

1
Cargo.lock generated

@ -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)",
]

@ -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

@ -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!(
"<!--- Downloaded from {} on {}using {} v{} -->\n",
&final_url,
downloaded_time.to_local().rfc822(),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),
),
);
if app_args.output == str!() {
println!("{}", html);
} else {

Loading…
Cancel
Save