about summary refs log tree commit diff stats
path: root/pkgs/by-name/ya/yambar-modules/src/main.rs
blob: 315c3be763962501b1f9c16d44fffd7e8335d0bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::{env::args, process};

mod cpu;
mod memory;

fn main() {
    let args: Vec<String> = args().collect();

    if args.len() != 2 {
        eprintln!("Usage: yambar-modules cpu|memory");
        process::exit(1);
    }

    match args[1].as_str() {
        "cpu" => {
            cpu::cpu();
        }
        "memory" => {
            memory::memory();
        }
        other => {
            eprintln!("'{other}' is not a valid command. Only 'cpu' or 'memory'.");
            process::exit(1);
        }
    }
}