| 1 | mod cli; |
| 2 | mod connection; |
| 3 | use clap::Parser; |
| 4 | use cli::Args; |
| 5 | use cli::Command; |
| 6 | use connection::Connection; |
| 7 | |
| 8 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 9 | let args = Args::parse(); |
| 10 | let mut conn = Connection::new("127.0.0.1:6600")?; |
| 11 | |
| 12 | match args.command { |
| 13 | Command::Volume { vol } => { |
| 14 | conn.set_volume(vol); |
| 15 | } |
| 16 | Command::Dmenu => conn.play_dmenu(), |
| 17 | Command::Fzf => conn.play_fzf(), |
| 18 | Command::Status => conn.status(), |
| 19 | Command::Pause => conn.pause(), |
| 20 | Command::Toggle => conn.toggle_pause(), |
| 21 | } |
| 22 | |
| 23 | Ok(()) |
| 24 | } |