This commit is contained in:
parent
b05bb05c48
commit
c1651ed993
3 changed files with 31 additions and 24 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -110,14 +110,6 @@ version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hello-world"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
"mpd",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_terminal_polyfill"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.70.1"
|
version = "1.70.1"
|
||||||
|
@ -133,6 +125,14 @@ dependencies = [
|
||||||
"bufstream",
|
"bufstream",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "noise"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"mpd",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell_polyfill"
|
name = "once_cell_polyfill"
|
||||||
version = "1.70.1"
|
version = "1.70.1"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "hello-world"
|
name = "noise"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
|
37
src/main.rs
37
src/main.rs
|
@ -1,27 +1,34 @@
|
||||||
extern crate mpd;
|
extern crate mpd;
|
||||||
|
|
||||||
use mpd::Client;
|
use mpd::Client;
|
||||||
use std::net::TcpStream;
|
// use std::net::TcpStream;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::{Parser, Subcommand};
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser)]
|
||||||
#[command(version, about, long_about = None)]
|
#[command(author, version, about, long_about = None)]
|
||||||
struct Args {
|
#[command(propagate_version = true)]
|
||||||
#[arg(short, long)]
|
|
||||||
name: String,
|
struct Cli {
|
||||||
#[arg(short, long)]
|
#[command(subcommand)]
|
||||||
count: u8,
|
command: Commands,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Subcommand)]
|
||||||
|
enum Commands {
|
||||||
|
/// Adds files to myapp
|
||||||
|
Add { name: Option<String> },
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut conn = Client::connect("localhost:6600").unwrap();
|
let mut conn = Client::connect("localhost:6600").unwrap();
|
||||||
|
|
||||||
conn.volume(100).unwrap();
|
conn.toggle_pause().unwrap();
|
||||||
println!("Status: {:?}", conn.status());
|
|
||||||
|
|
||||||
// let args = Args::parse();
|
let cli = Cli::parse();
|
||||||
// for _ in 0..args.count {
|
match &cli.command {
|
||||||
// println!("Hello {}!", args.name)
|
Commands::Add { name } => {
|
||||||
// }
|
println!("'myapp add' was used, name is: {:?}", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue