Support for adding data from command line
This commit is contained in:
parent
bf3114d1e0
commit
a3f18d271d
13
src/main.rs
13
src/main.rs
|
@ -1,4 +1,4 @@
|
|||
use std::env::var;
|
||||
use std::env::{args, var};
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
|
||||
|
@ -20,7 +20,7 @@ pub fn main() {
|
|||
let kernel = format!("{style}Kernel:{unstyle} {}", kernel().unwrap(), style = style, unstyle = unstyle);
|
||||
let uptime = format!("{style}Uptime:{unstyle} {}", &uptime().unwrap()[3..], style = style, unstyle = unstyle);
|
||||
|
||||
let info = [
|
||||
let mut info = vec![
|
||||
String::from("\n"),
|
||||
username,
|
||||
osname,
|
||||
|
@ -28,6 +28,15 @@ pub fn main() {
|
|||
uptime,
|
||||
];
|
||||
|
||||
for arg in args().skip(1) {
|
||||
let split = arg.split(":").collect::<Vec<_>>();
|
||||
if split.len() != 2 {
|
||||
eprintln!("\x1B[33;1mwarning:\x1B[0m argument must be formatted like \"key:value\"");
|
||||
continue;
|
||||
}
|
||||
info.push(format!("{style}{}:{unstyle} {}\n", split[0], split[1], style = style, unstyle = unstyle));
|
||||
}
|
||||
|
||||
let mut logo_iterator = Os::ArchLinux.ascii_logo().lines();
|
||||
let mut info_iterator = info.iter();
|
||||
|
||||
|
|
Loading…
Reference in New Issue