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