Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Switch from --terminal to --headless
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Nov 1, 2019
1 parent fbdbc7c commit 9106cf8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
30 changes: 0 additions & 30 deletions src/commands/init/subcommand.rs

This file was deleted.

6 changes: 3 additions & 3 deletions src/commands/preview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn preview(
body: Option<String>,
livereload: bool,
verbose: bool,
browser: bool,
headless: bool,
) -> Result<(), failure::Error> {
commands::build(&target)?;

Expand All @@ -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,
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()?;
Expand Down
2 changes: 1 addition & 1 deletion tests/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ fn preview(fixture: &str) {

let mut preview = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
preview.current_dir(utils::fixture_path(fixture));
preview.arg("preview").arg("-t").assert().success();
preview.arg("preview").arg("--headless").assert().success();
}

0 comments on commit 9106cf8

Please sign in to comment.