wip
This commit is contained in:
parent
9215820374
commit
c024f85f46
33
src/main.rs
33
src/main.rs
@ -11,6 +11,8 @@
|
|||||||
This file contains the primary logic of the application
|
This file contains the primary logic of the application
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
|
||||||
use colored::{ColoredString, Colorize};
|
use colored::{ColoredString, Colorize};
|
||||||
|
|
||||||
use wrappers::pacman;
|
use wrappers::pacman;
|
||||||
@ -21,8 +23,34 @@ mod wrappers;
|
|||||||
fn main() {
|
fn main() {
|
||||||
println!("{}", copyright_notice());
|
println!("{}", copyright_notice());
|
||||||
|
|
||||||
|
let mut args = env::args();
|
||||||
|
|
||||||
|
// Drop the file location from args
|
||||||
|
if args.next().is_none() {
|
||||||
|
error_println("Unexpected error in argument collection. Aborting.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let args: Vec<String> = args.collect();
|
||||||
|
|
||||||
|
for arg in &args {}
|
||||||
|
|
||||||
|
if args.is_empty() {
|
||||||
|
print_help_text();
|
||||||
|
} else {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print_help_text() {
|
||||||
|
println!(
|
||||||
|
"rust-archlinux-updater [OPTIONS]\n\n\
|
||||||
|
Options:\n\
|
||||||
|
-h, --help | Show this help message\n\
|
||||||
|
-u | preform a regular update\n\
|
||||||
|
-p | Use paru to update the AUR packages on your system"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn update() {
|
fn update() {
|
||||||
if let Err(e) = pacman::check() {
|
if let Err(e) = pacman::check() {
|
||||||
@ -64,7 +92,10 @@ fn update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn copyright_notice() -> ColoredString {
|
fn copyright_notice() -> ColoredString {
|
||||||
"Rust Arch Linux Updater Copyright (C) 2024 Luke Harding <luke@lukeh990.io>\nThis program comes with ABSOLUTELY NO WARRANTY\nThis is free software, and you are welcome to redistribute it under certain conditions\n".italic()
|
"Rust Arch Linux Updater Copyright (C) 2024 Luke Harding <luke@lukeh990.io>\
|
||||||
|
\nThis program comes with ABSOLUTELY NO WARRANTY\
|
||||||
|
\nThis is free software, and you are welcome to redistribute it under certain conditions\n"
|
||||||
|
.italic()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn error_println(msg: impl Into<String>) {
|
pub fn error_println(msg: impl Into<String>) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user