summaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: e17742ed7a626ce84d316c4afc46342811c58fca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use i3blocks_mpris::component::{Icon, Next, Play, Prev, Runner, Title, Volume};

#[tokio::main]
async fn main() -> Result<(), main_error::MainError> {
    let stdin = std::io::stdin();
    match std::env::args().nth(1).as_deref().unwrap_or("icon") {
        "icon" => Icon::run(stdin).await,
        "next" => Next::run(stdin).await,
        "play" => Play::run(stdin).await,
        "prev" => Prev::run(stdin).await,
        "title" => Title::run(stdin).await,
        "volume" => Volume::run(stdin).await,
        s => {
            eprintln!("Invalid component name: {s}");
            std::process::exit(1)
        }
    }
    .map_err(Into::into)
}