noise-rs/src/noise/parser.rs
2025-07-08 18:55:41 +02:00

115 lines
3.1 KiB
Rust

use clap::{Parser, Subcommand, ValueHint};
use clap_complete::Shell;
#[derive(Parser, Debug, PartialEq)]
#[command(
author = "Nox Sluijtman",
version,
about = "A small MPD client",
long_about = "I like how 'mpc' works for the most part, but I don't use most of its features and there are some parts of it that I feel could be more ergonomic. In comes 'noise', an opinionated, even more minimalist 'mpd' client than 'mpc'.",
name = "noise"
)]
// #[command(propagate_version = true)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
/// Enables verbose output
#[arg(short, long, global = true)]
pub verbose: bool,
/// Hostname where MPD listens at
#[arg(short = 'H', long, global = true, value_hint = ValueHint::Hostname)]
pub host: Option<String>,
/// Generate shell completions
#[arg(long = "generate-completions", value_enum)]
pub completions: Option<Shell>,
}
#[derive(Subcommand, Debug, PartialEq)]
pub enum Commands {
/// Toggle MPD playback
#[command(visible_alias = "t")]
Toggle,
/// Skip to the next track
#[command(visible_alias = "skip")]
Next,
/// Revert to the previous track
Prev,
/// Stops playing
Stop,
/// Play queueueu
#[command(visible_alias = "start")]
Play {
#[arg(value_hint = ValueHint::Other)]
track: Option<u32>,
},
/// Set or get crossfade
#[command(visible_alias = "fade")]
Crossfade {
#[arg(value_hint = ValueHint::Other)]
seconds: Option<i64>,
},
// ///Update still needs some work
// Update,
/// Return currently playing song
Current,
/// Clear current queueueu
Clear,
/// Query database
#[command(visible_alias = "q")]
Search {
///Search query
#[arg(trailing_var_arg = true, value_hint = ValueHint::Other)]
query: Vec<String>,
///Only return the first n results
#[arg(short, long, value_hint = ValueHint::Other)]
max: Option<u32>,
// #[arg(short, long)]
// append: bool,
// #[arg(short, long)]
// insert: Option<u32>,
},
/// Query database autistically
#[command(visible_alias = "fd")]
Find {
///Search query
#[arg(trailing_var_arg = true, value_hint = ValueHint::Other)]
query: Vec<String>,
///Only return the first n results
#[arg(short, long, value_hint = ValueHint::Other)]
max: Option<u32>,
#[arg(short, long)]
append: bool,
},
/// List items in the current queueueu
#[command(visible_alias = "ls")]
List {
#[arg(short, long)]
file: bool,
},
// Add {
// #[arg(short, long)]
// position: Option<u32>,
// },
/// Shuffles the current queueue
#[command(visible_alias = "shuf")]
Shuffle,
/// Toggles repeat
Repeat,
/// Toggles random
Random,
/// Toggles consume
Consume,
/// Toggles single
Single,
/// Get or set volume
#[command(visible_alias = "vol")]
Volume {
#[arg(value_hint = ValueHint::Other)]
percentage: Option<i8>,
},
Munch,
Length,
}