2025-06-07 11:24:20 +02:00
|
|
|
extern crate mpd;
|
|
|
|
|
|
|
|
use mpd::Client;
|
2025-06-07 11:43:42 +02:00
|
|
|
// use std::net::TcpStream;
|
2025-06-07 11:24:20 +02:00
|
|
|
|
2025-06-07 11:43:42 +02:00
|
|
|
use clap::{Parser, Subcommand};
|
2025-06-07 11:24:20 +02:00
|
|
|
|
2025-06-07 11:43:42 +02:00
|
|
|
#[derive(Parser)]
|
|
|
|
#[command(author, version, about, long_about = None)]
|
|
|
|
#[command(propagate_version = true)]
|
|
|
|
|
|
|
|
struct Cli {
|
|
|
|
#[command(subcommand)]
|
|
|
|
command: Commands,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subcommand)]
|
|
|
|
enum Commands {
|
|
|
|
/// Adds files to myapp
|
|
|
|
Add { name: Option<String> },
|
2025-06-07 11:24:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut conn = Client::connect("localhost:6600").unwrap();
|
|
|
|
|
2025-06-07 11:43:42 +02:00
|
|
|
conn.toggle_pause().unwrap();
|
2025-06-07 11:24:20 +02:00
|
|
|
|
2025-06-07 11:43:42 +02:00
|
|
|
let cli = Cli::parse();
|
|
|
|
match &cli.command {
|
|
|
|
Commands::Add { name } => {
|
|
|
|
println!("'myapp add' was used, name is: {:?}", name)
|
|
|
|
}
|
|
|
|
}
|
2025-06-07 11:24:20 +02:00
|
|
|
}
|