aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 09c73631e951d07f13685affd5092bd9cfe25866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mod cli;
mod connection;
use clap::Parser;
use cli::Args;
use cli::Command;
use connection::Connection;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let args = Args::parse();
    let mut conn = Connection::new("127.0.0.1:6600")?;

    match args.command {
        Command::Volume { vol } => {
            conn.set_volume(vol);
        }
        Command::Dmenu => conn.play_dmenu(),
        Command::Fzf => conn.play_fzf(),
        Command::Status => conn.status(),
        Command::Pause => conn.pause(),
        Command::Toggle => conn.toggle_pause(),
    }

    Ok(())
}