diff --git a/src/args.rs b/src/args.rs index 9448d5f..a7aab9c 100644 --- a/src/args.rs +++ b/src/args.rs @@ -12,6 +12,7 @@ pub struct AppArgs { pub output: String, pub silent: bool, pub user_agent: String, + pub no_context: bool, } const DEFAULT_USER_AGENT: &str = @@ -31,6 +32,7 @@ impl AppArgs { .help("URL to download"), ) // .args_from_usage("-a, --include-audio 'Embed audio sources'") + .args_from_usage("-C, --no-context 'Exclude time and original URL in output'") .args_from_usage("-c, --no-css 'Ignore styles'") .args_from_usage("-f, --no-frames 'Exclude iframes'") .args_from_usage("-i, --no-images 'Remove images'") @@ -48,6 +50,7 @@ impl AppArgs { .value_of("url") .expect("please set target url") .to_string(); + app_args.no_context = app.is_present("no-context"); app_args.no_css = app.is_present("no-css"); app_args.no_frames = app.is_present("no-frames"); app_args.no_images = app.is_present("no-images"); diff --git a/src/main.rs b/src/main.rs index 4141390..27cf030 100644 --- a/src/main.rs +++ b/src/main.rs @@ -95,16 +95,18 @@ 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.no_context { + html.insert_str( + 0, + &format!( + "\n", + &final_url, + downloaded_time.rfc822(), + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION"), + ), + ); + } if app_args.output == str!() { println!("{}", html);