Skip to content

Commit 887510b

Browse files
committed
git
1 parent b86373c commit 887510b

File tree

6 files changed

+21
-41
lines changed

6 files changed

+21
-41
lines changed

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ Cargo.lock
1111
**/*.rs.bk
1212

1313
# MSVC Windows builds of rustc generate these, which store debugging information
14-
*.pdb
15-
16-
hidden/
14+
*.pdb

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ regex = "0.1"
1212
reqwest = { version = "0.11.0", features = ["blocking"] }
1313
rodio = "0.17.3"
1414
sys-info = "0.7.0"
15-
clap = "3.0"
15+
clap = "3.0"
16+
clearscreen = "2.0.1"

mylibrary/clone.stk

-1
This file was deleted.

mylibrary/queue.stk

-11
This file was deleted.

mysrc/stackprogramminglanguage.stk

-24
This file was deleted.

src/main.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -1287,15 +1287,32 @@ impl Executor {
12871287
return;
12881288
}
12891289
}
1290-
self.log_print(String::from("Error! item not found in this list").as_str().to_owned() + "\n");
1290+
self.log_print("Error! item not found in this list".to_owned() + "\n");
12911291
self.stack.push(Type::Error(String::from("item-not-found")));
12921292
}
12931293

1294+
"cls" => {
1295+
self.clearscreen();
1296+
}
1297+
1298+
"clear" => {
1299+
self.clearscreen();
1300+
}
1301+
12941302
// If it is not recognized as a command, use it as a string.
12951303
_ => self.stack.push(Type::String(command)),
12961304
}
12971305
}
12981306

1307+
fn clearscreen(&mut self) {
1308+
let result = clearscreen::clear();
1309+
if result.is_err() {
1310+
println!("Error! Failed to clear screen");
1311+
self.stack
1312+
.push(Type::Error(String::from("failed-to-clear-screen")));
1313+
}
1314+
}
1315+
12991316
/// Pop stack's top value
13001317
fn pop_stack(&mut self) -> Type {
13011318
if let Some(value) = self.stack.pop() {

0 commit comments

Comments
 (0)