Skip to content

Commit 246716c

Browse files
authored
Update utils.rs
1 parent 9bdcc0a commit 246716c

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

src/utils.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ use std::io::{self, Write};
44
use std::thread;
55
use std::time::Duration;
66
use std::sync::{Arc, atomic::{AtomicBool, Ordering}};
7-
87
pub fn run_command_with_spinner(program: &str, args: Vec<&str>, message: &str) {
98
println!("{}", format!("{}: {}", message, args.join(" ")).blue().bold().on_black());
10-
119
let stop = Arc::new(AtomicBool::new(false));
1210
let stop_clone = stop.clone();
1311
let spinner_chars: Vec<&str> = vec!["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
14-
1512
let handle = thread::spawn(move || {
1613
let mut i = 0;
1714
while !stop_clone.load(Ordering::Relaxed) {
@@ -23,26 +20,21 @@ pub fn run_command_with_spinner(program: &str, args: Vec<&str>, message: &str) {
2320
print!("\r \r");
2421
let _ = io::stdout().flush();
2522
});
26-
2723
let child = Command::new(program)
2824
.args(&args)
2925
.stdout(Stdio::piped())
3026
.stderr(Stdio::piped())
3127
.spawn()
3228
.expect(&format!("Failed to execute {}", program));
33-
3429
let output = child.wait_with_output().expect("Failed to wait on child");
35-
3630
stop.store(true, Ordering::Relaxed);
3731
handle.join().unwrap();
38-
3932
if output.status.success() {
4033
println!("{}", String::from_utf8_lossy(&output.stdout).green().bold().on_black());
4134
} else {
4235
println!("{}", String::from_utf8_lossy(&output.stderr).red().bold().on_black());
4336
}
4437
}
45-
4638
pub fn handle_update() {
4739
println!("{}", "========== Starting System Update ==========".magenta().bold().on_black());
4840
run_command_with_spinner("sudo", vec!["apt", "update"], "Updating APT repositories");
@@ -52,7 +44,6 @@ pub fn handle_update() {
5244
run_command_with_spinner("fwupdmgr", vec!["update"], "Updating firmware");
5345
println!("{}", "========== System Update Complete ==========".green().bold().on_black());
5446
}
55-
5647
pub fn handle_cybersecurity() {
5748
println!("{}", "========== Installing Penetration Tools ==========".cyan().bold().on_black());
5849
run_command_with_spinner("flatpak", vec!["remote-add", "--if-not-exists", "flathub", "https://dl.flathub.org/repo/flathub.flatpakrepo"], "Adding flathub repo");
@@ -63,7 +54,6 @@ pub fn handle_cybersecurity() {
6354
run_command_with_spinner("flatpak", vec!["install", "-y", "flathub", "org.ghidra_sre.Ghidra"], "Installing Ghidra");
6455
println!("{}", "========== Hacker-Unpack-Cybersecurity Complete ==========".green().bold().on_black());
6556
}
66-
6757
pub fn handle_gaming() {
6858
println!("{}", "========== Installing Gaming Tools ==========".cyan().bold().on_black());
6959
run_command_with_spinner("flatpak", vec!["remote-add", "--if-not-exists", "flathub", "https://dl.flathub.org/repo/flathub.flatpakrepo"], "Adding flathub repo");

0 commit comments

Comments
 (0)