spotify_cli/cli/args/
user.rs

1//! User and info command definitions.
2
3use clap::Subcommand;
4
5use crate::constants::{DEFAULT_LIMIT, DEFAULT_OFFSET};
6
7#[derive(Subcommand)]
8pub enum UserCommand {
9    /// Get your profile information
10    Profile,
11    /// Get your top tracks or artists
12    Top {
13        /// What to get: tracks or artists
14        #[arg(value_parser = ["tracks", "artists"])]
15        item_type: String,
16        /// Time range: short (4 weeks), medium (6 months), long (years)
17        #[arg(long, short = 'r', default_value = "medium", value_parser = ["short", "medium", "long"])]
18        range: String,
19        /// Number of results (default 20, max 50)
20        #[arg(long, short = 'l', default_value_t = DEFAULT_LIMIT)]
21        limit: u8,
22    },
23    /// Get another user's profile
24    Get {
25        /// Spotify username
26        user_id: String,
27    },
28}
29
30#[derive(Subcommand)]
31pub enum InfoCommand {
32    /// Get track details (defaults to now playing)
33    Track {
34        /// Track ID or URL (optional - defaults to now playing)
35        id: Option<String>,
36        /// Output only the ID (for piping)
37        #[arg(long)]
38        id_only: bool,
39    },
40    /// Get album details (defaults to now playing album)
41    Album {
42        /// Album ID or URL (optional - defaults to now playing album)
43        id: Option<String>,
44        /// Output only the ID (for piping)
45        #[arg(long)]
46        id_only: bool,
47    },
48    /// Get artist details (defaults to now playing artist)
49    Artist {
50        /// Artist ID or URL (optional - defaults to now playing artist)
51        id: Option<String>,
52        /// Output only the ID (for piping)
53        #[arg(long)]
54        id_only: bool,
55        /// Get artist's top tracks instead of details
56        #[arg(long, short = 't', conflicts_with_all = ["albums", "related"])]
57        top_tracks: bool,
58        /// Get artist's albums instead of details
59        #[arg(long, short = 'a', conflicts_with_all = ["top_tracks", "related"])]
60        albums: bool,
61        /// Get related artists instead of details
62        #[arg(long, short = 'r', conflicts_with_all = ["top_tracks", "albums"])]
63        related: bool,
64        /// Market for top tracks (ISO 3166-1 alpha-2 country code)
65        #[arg(long, short = 'm', default_value = "US")]
66        market: String,
67        /// Number of albums to return (default 20, max 50)
68        #[arg(long, short = 'l', default_value_t = DEFAULT_LIMIT)]
69        limit: u8,
70        /// Offset for album pagination
71        #[arg(long, short = 'o', default_value_t = DEFAULT_OFFSET)]
72        offset: u32,
73    },
74}