Skip to content

Commit

Permalink
fix(cli): fixed serve/test numbering issues
Browse files Browse the repository at this point in the history
  • Loading branch information
arctic-hen7 committed Jan 12, 2023
1 parent bc7582a commit 99e13be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
16 changes: 3 additions & 13 deletions packages/perseus-cli/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ fn build_server(
dir: PathBuf,
spinners: &MultiProgress,
num_steps: u8,
step_offset: u8,
exec: Arc<Mutex<String>>,
is_release: bool,
tools: &Tools,
Expand All @@ -54,7 +53,7 @@ fn build_server(
// Server building message
let sb_msg = format!(
"{} {} Building server",
style(format!("[{}/{}]", num_steps - step_offset, num_steps))
style(format!("[{}/{}]", num_steps - 1, num_steps))
.bold()
.dim(),
BUILDING_SERVER
Expand All @@ -63,7 +62,7 @@ fn build_server(
// We'll parallelize the building of the server with any build commands that are
// currently running We deliberately insert the spinner at the end of the
// list
let sb_spinner = spinners.insert((num_steps - step_offset).into(), ProgressBar::new_spinner());
let sb_spinner = spinners.insert((num_steps - 1).into(), ProgressBar::new_spinner());
let sb_spinner = cfg_spinner(sb_spinner, &sb_msg);
let sb_target = dir;
let sb_thread = spawn_thread(
Expand Down Expand Up @@ -220,15 +219,7 @@ pub fn serve(
let should_run = !opts.no_run;

// Weird naming here, but this is right
let num_steps = if testing && did_build {
4
} else if testing && !did_build {
3
} else if !testing && did_build {
4
} else {
2
};
let num_steps = if did_build { 4 } else { 2 };

// We need to have a way of knowing what the executable path to the server is
let exec = Arc::new(Mutex::new(String::new()));
Expand All @@ -238,7 +229,6 @@ pub fn serve(
dir.clone(),
&spinners,
num_steps,
if testing { 2 } else { 1 },
Arc::clone(&exec),
opts.release,
tools,
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus-cli/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn test(
host: test_opts.host.clone(),
port: test_opts.port,
};
let num_steps: u8 = if test_opts.no_build { 3 } else { 4 };
let num_steps: u8 = if test_opts.no_build { 2 } else { 4 };
// This will do all sorts of things with spinners etc., but we've told it we're
// testing, so things will be neater
let spinners = MultiProgress::new();
Expand Down

0 comments on commit 99e13be

Please sign in to comment.