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 "
) ]
#[ 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
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 > ,
// /// Generate manpage
// #[arg(long = "generate-manpage", value_enum)]
// pub manpage: bool,
}
#[ derive(Subcommand, Debug, PartialEq) ]
pub enum Commands {
2025-07-02 23:29:01 +02:00
/// Toggle MPD playback
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 {
#[ arg(short, long, value_hint = ValueHint::Other) ]
seconds : Option < i64 > ,
} ,
///Update still needs some work
Update ,
/// 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
Shuffle ,
}