diff options
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..5063187 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,149 @@ +use clap::{Parser, Subcommand}; +use std::path::PathBuf; + +#[derive(Parser)] +#[command(name = "squid-downloader")] +#[command(author = "Squid Downloader")] +#[command(version = "0.1.0")] +#[command(about = "Download high-quality music from multiple streaming services", long_about = None)] +#[command(color = clap::ColorChoice::Always)] +pub struct Cli { + #[command(subcommand)] + pub command: Commands, + + #[arg( + short, + long, + global = true, + help = "Output directory for downloads" + )] + pub output: Option<PathBuf>, + + #[arg(short, long, global = true, help = "Audio quality", value_parser = ["hires", "lossless", "high", "low", "mp3"])] + pub quality: Option<String>, + + #[arg(short, long, global = true, help = "Streaming service", value_parser = ["tidal", "amazon", "soundcloud", "khinsider"])] + pub service: Option<String>, + + #[arg( + long, + global = true, + help = "Suppress non-essential output" + )] + pub quiet: bool, + + #[arg( + short = 'j', + long, + global = true, + help = "Max concurrent downloads (default: CPU cores)" + )] + pub concurrent: Option<usize>, + + #[arg(short = 'd', long, global = true, help = "Directory organization mode", value_parser = ["playlist", "album", "artist", "flat"])] + pub dir_mode: Option<String>, +} + +#[derive(Subcommand)] +pub enum Commands { + #[command(about = "Search for tracks")] + Search { + #[arg(help = "Search query (song title)")] + query: String, + + #[arg( + short, + long, + help = "Artist name to improve accuracy" + )] + artist: Option<String>, + + #[arg( + short = 'n', + long, + default_value = "10", + help = "Number of results" + )] + limit: usize, + }, + + #[command(about = "Download a single track")] + Track { + #[arg(help = "Track ID or search query")] + input: String, + + #[arg( + short, + long, + help = "Artist name to improve accuracy" + )] + artist: Option<String>, + + #[arg( + short = 'f', + long, + help = "Download first result without prompting" + )] + first: bool, + }, + + #[command(about = "Download an entire album")] + Album { + #[arg(help = "Album ID or search query")] + input: String, + }, + + #[command(about = "Download tracks from an artist")] + Artist { + #[arg(help = "Artist ID or search query")] + input: String, + }, + + #[command(about = "Download a playlist")] + Playlist { + #[arg(help = "Playlist ID or URL")] + input: String, + }, + + #[command(about = "Import and download tracks from CSV file")] + Csv { + #[arg(help = "Path to CSV file")] + file: PathBuf, + + #[arg( + short = 't', + long, + default_value = "0.6", + help = "Minimum confidence threshold (0.0-1.0)" + )] + threshold: f64, + + #[arg( + short = 'y', + long, + help = "Skip confirmation prompt" + )] + yes: bool, + }, + + #[command(about = "Show information about a track")] + Info { + #[arg(help = "Track ID")] + id: u64, + }, + + #[command(about = "Get recommendations for a track")] + Recommend { + #[arg(help = "Track ID")] + id: u64, + }, + + #[command(about = "List available qualities and services")] + List, +} + +impl Cli { + pub fn parse() -> Self { + Parser::parse() + } +} |
