2025-07-02 23:07:43 +02:00
use clap ::{ Parser , Subcommand , ValueHint } ;
use clap_complete ::Shell ;
#[ derive(Parser, Debug, PartialEq) ]
#[ command(
author = " Nox Sluijtman " ,
version ,
2025-07-02 23:29:01 +02:00
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'. " ,
2025-07-02 23:07:43 +02:00
name = " noise "
) ]
2025-07-08 18:55:41 +02:00
// #[command(propagate_version = true)]
2025-07-02 23:07:43 +02:00
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
2025-07-02 23:29:01 +02:00
#[ arg(short = 'H', long, global = true, value_hint = ValueHint::Hostname) ]
2025-07-02 23:07:43 +02:00
pub host : Option < String > ,
/// Generate shell completions
#[ arg(long = " generate-completions " , value_enum) ]
pub completions : Option < Shell > ,
}
#[ derive(Subcommand, Debug, PartialEq) ]
pub enum Commands {
2025-07-02 23:29:01 +02:00
/// Toggle MPD playback
2025-07-03 23:01:21 +02:00
#[ command(visible_alias = " t " ) ]
2025-07-02 23:07:43 +02:00
Toggle ,
/// Skip to the next track
2025-07-02 23:29:01 +02:00
#[ command(visible_alias = " skip " ) ]
2025-07-02 23:07:43 +02:00
Next ,
/// Revert to the previous track
Prev ,
/// Stops playing
Stop ,
/// Play queueueu
2025-07-02 23:29:01 +02:00
#[ command(visible_alias = " start " ) ]
2025-07-02 23:07:43 +02:00
Play {
2025-07-02 23:32:51 +02:00
#[ arg(value_hint = ValueHint::Other) ]
2025-07-02 23:07:43 +02:00
track : Option < u32 > ,
} ,
/// Set or get crossfade
2025-07-02 23:29:01 +02:00
#[ command(visible_alias = " fade " ) ]
2025-07-02 23:07:43 +02:00
Crossfade {
2025-07-02 23:34:24 +02:00
#[ arg(value_hint = ValueHint::Other) ]
2025-07-02 23:07:43 +02:00
seconds : Option < i64 > ,
} ,
2025-07-08 18:55:41 +02:00
// ///Update still needs some work
// Update,
2025-07-02 23:07:43 +02:00
/// Return currently playing song
Current ,
/// Clear current queueueu
Clear ,
/// Query database
2025-07-02 23:29:01 +02:00
#[ command(visible_alias = " q " ) ]
2025-07-02 23:07:43 +02:00
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>,
} ,
2025-07-02 23:29:01 +02:00
/// Query database autistically
#[ command(visible_alias = " fd " ) ]
2025-07-02 23:07:43 +02:00
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
2025-07-02 23:29:01 +02:00
#[ command(visible_alias = " ls " ) ]
2025-07-02 23:07:43 +02:00
List {
#[ arg(short, long) ]
file : bool ,
} ,
// Add {
// #[arg(short, long)]
// position: Option<u32>,
// },
/// Shuffles the current queueue
2025-07-08 18:55:41 +02:00
#[ command(visible_alias = " shuf " ) ]
2025-07-02 23:07:43 +02:00
Shuffle ,
2025-07-06 00:20:06 +02:00
/// 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 > ,
} ,
2025-07-08 18:55:41 +02:00
Munch ,
Length ,
2025-07-02 23:07:43 +02:00
}