Shell completions
This commit is contained in:
parent
c21072727c
commit
49f7746f57
6 changed files with 219 additions and 86 deletions
94
src/cli.rs
Normal file
94
src/cli.rs
Normal file
|
@ -0,0 +1,94 @@
|
|||
use clap::{Parser, Subcommand, ValueHint};
|
||||
use clap_complete::Shell;
|
||||
|
||||
#[derive(Parser, Debug, PartialEq)]
|
||||
#[command(
|
||||
author = "Nox Sluijtman",
|
||||
version,
|
||||
about,
|
||||
long_about = "A small, opinionated MPD client",
|
||||
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)]
|
||||
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 {
|
||||
/// Toggle MPD stream
|
||||
Toggle,
|
||||
/// Skip to the next track
|
||||
Next,
|
||||
/// Revert to the previous track
|
||||
Prev,
|
||||
/// Stops playing
|
||||
Stop,
|
||||
/// Play queueueu
|
||||
Play {
|
||||
#[arg(short, long, value_hint = ValueHint::Other)]
|
||||
track: Option<u32>,
|
||||
},
|
||||
/// Set or get crossfade
|
||||
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
|
||||
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 differently
|
||||
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
|
||||
List {
|
||||
#[arg(short, long)]
|
||||
file: bool,
|
||||
},
|
||||
// Add {
|
||||
// #[arg(short, long)]
|
||||
// position: Option<u32>,
|
||||
// },
|
||||
/// Shuffles the current queueue
|
||||
Shuffle,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue