From 250decad377b53fca1c33ed622e8b4df9cb67f25 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Fri, 1 Nov 2019 10:57:23 -0500 Subject: [PATCH] Switch from --terminal to --headless --- src/commands/preview/mod.rs | 6 +++--- src/main.rs | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/commands/preview/mod.rs b/src/commands/preview/mod.rs index 99c0f796b..74a84f457 100644 --- a/src/commands/preview/mod.rs +++ b/src/commands/preview/mod.rs @@ -34,7 +34,7 @@ pub fn preview( body: Option, livereload: bool, verbose: bool, - browser: bool, + headless: bool, ) -> Result<(), failure::Error> { commands::build(&target)?; @@ -54,7 +54,7 @@ pub fn preview( info!("Opened websocket server on port {}", ws_port); - if browser { + if !headless { open_browser(&format!( "https://cloudflareworkers.com/?wrangler_session_id={0}&wrangler_ws_port={1}&hide_editor#{2}:{3}{4}", &session.to_string(), ws_port, script_id, https_str, preview_host, @@ -73,7 +73,7 @@ pub fn preview( verbose, )?; } else { - if browser { + if !headless { open_browser(&format!( "https://cloudflareworkers.com/?hide_editor#{0}:{1}{2}", script_id, https_str, preview_host diff --git a/src/main.rs b/src/main.rs index 40a4f16e5..95a4da0e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -309,10 +309,9 @@ fn run() -> Result<(), failure::Error> { emoji::MICROSCOPE )) .arg( - Arg::with_name("terminal") - .help("Preview your worker in the terminal and not the browser") - .short("t") - .long("terminal") + Arg::with_name("headless") + .help("Don't open the browser on preview") + .long("headless") .takes_value(false) ) .arg( @@ -479,9 +478,9 @@ fn run() -> Result<(), failure::Error> { let watch = matches.is_present("watch"); let verbose = matches.is_present("verbose"); - let browser = !matches.is_present("terminal"); + let headless = matches.is_present("headless"); - commands::preview(target, user, method, body, watch, verbose, browser)?; + commands::preview(target, user, method, body, watch, verbose, headless)?; } else if matches.subcommand_matches("whoami").is_some() { log::info!("Getting User settings"); let user = settings::global_user::GlobalUser::new()?;