diff --git a/Cargo.toml b/Cargo.toml index 5d06d60..d737a10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,6 @@ version = "4.1.4" features = ["wrap_help", "cargo", "usage", "derive", "suggestions", "color"] [features] -lyirc = ["lrc"] +lyrics = ["lrc"] -default = [] +default = ["lyrics"] diff --git a/src/arguments.rs b/src/arguments.rs new file mode 100644 index 0000000..1e0e74d --- /dev/null +++ b/src/arguments.rs @@ -0,0 +1,51 @@ +use clap::{Parser}; + +#[derive(Parser, Debug)] +#[command(author, about, version, long_about = None)] +pub struct Arguments { + /// The notification timeout, in seconds + #[arg(short, long, default_value = "5")] + pub timeout: u8, + /// Make the notification persistent, i.e. not disappear after a timeout (you can dismiss it manually) + #[arg(short, long)] + pub persistent: bool, + /// Show the track cover in the notification, if available + #[clap(short = 'c', long = "cover")] + pub show_track_cover: bool, + /// The static icon to use for the notification, it not effective if the track cover is shown, + /// but if the cover is not available or you disabled it, this icon will be used. + /// + /// you can give it the full path to an image file or a name of an icon from the current icon theme + /// (e.g. "audio-x-generic" or "spotify-client") + #[clap(short = 'i', long = "icon", default_value = None)] + pub notification_static_icon: Option, + /// The path to look for the cover image, if not given, the cover will be searched in the track's directory + /// for an image file with the name "cover". + /// + /// You can use the placeholder "{artist}" and "{album}" and "{title}" in the path, + /// they will be replaced with the corresponding metadata. + /// And you can use the simple glob pattern `*` to match any character. + /// e.g. "covers/{artist}/{album}/cover.*", "covers/{artist}/{album}/*", + /// + /// If you not specify the full path, the cover will be started from the track's directory. + #[clap(short = 'w', long = "cover-path", default_value = None)] + pub cover_path: Option, + #[cfg(feature = "lyrics")] + /// The lyrics file path, if not given, the lyrics will be searched in the track's directory + /// for a text file with the name "lyrics", or with the same name as the track. + /// + /// You can use the placeholder "{artist}" and "{album}" and "{title}" in the path, + /// they will be replaced with the corresponding metadata. + /// And you can use the simple glob pattern `*` to match any character. + /// e.g. "lyrics/{artist}/{album}/{title}.lrc", "lyrics/{artist}/{album}/*", + /// + /// If you not specify the full path, the lyrics will be started from the track's directory. + #[arg(short, long, default_value = None)] + pub lyrics_path: Option, + /// The maximum path depth to search for the cover and lyrics files, + /// if the files are not found in the track's directory, or the directory specified by the `--cover-path` + /// or `--lyrics-path`* options, the program will search in the parent directory, + /// and so on, until the maximum depth is reached. + #[arg(short, long, default_value = "3")] + pub depth: u8, +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..17c790f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,8 @@ +mod arguments; + +use clap::Parser; + fn main() { - println!("Hello, world!"); + let _args = arguments::Arguments::parse(); + println!("{_args:#?}"); }