Skip to content

Commit 019ca6f

Browse files
committed
Simplify code for print_*_prompt by removing overwrite: bool argument
1 parent f976b72 commit 019ca6f

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/modules/julia.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ impl Module for Julia {
5252
// julia startup
5353
print_banner().await;
5454
csleep(rng.gen_range(50..150)).await;
55-
print_julia_prompt(false).await;
55+
newline().await;
56+
print_julia_prompt().await;
5657

5758
// wait user input
5859
csleep(rng.gen_range(500..2500)).await;
5960

6061
// enter pkg mode
61-
print_pkg_prompt(project, true).await;
62+
erase_line().await;
63+
print_pkg_prompt(project).await;
6264

6365
// wait user input
6466
csleep(rng.gen_range(500..1500)).await;
@@ -102,13 +104,15 @@ impl Module for Julia {
102104
// wait cleanup
103105
csleep(rng.gen_range(50..250)).await;
104106

105-
print_pkg_prompt(project, false).await;
107+
newline().await;
108+
print_pkg_prompt(project).await;
106109

107110
// wait user input
108111
csleep(rng.gen_range(500..5000)).await;
109112

110113
// exit pkg mode
111-
print_julia_prompt(true).await;
114+
erase_line().await;
115+
print_julia_prompt().await;
112116

113117
// wait user input
114118
csleep(rng.gen_range(1000..7000)).await;
@@ -145,21 +149,11 @@ async fn print_banner() {
145149
.await;
146150
}
147151

148-
async fn print_julia_prompt(overwrite: bool) {
149-
if overwrite {
150-
erase_line().await;
151-
} else {
152-
newline().await;
153-
}
152+
async fn print_julia_prompt() {
154153
print(format!("{} ", Paint::green("julia>").bold())).await;
155154
}
156155

157-
async fn print_pkg_prompt(project: &str, overwrite: bool) {
158-
if overwrite {
159-
erase_line().await;
160-
} else {
161-
newline().await;
162-
}
156+
async fn print_pkg_prompt(project: &str) {
163157
print(format!(
164158
"{} ",
165159
Paint::blue(format!("({}) pkg>", project)).bold()

0 commit comments

Comments
 (0)