spotify_cli/cli/args/playlist.rs
1//! Playlist command definitions.
2
3use clap::Subcommand;
4
5use crate::constants::{DEFAULT_LIMIT, DEFAULT_OFFSET};
6
7#[derive(Subcommand)]
8pub enum PlaylistCommand {
9 /// List your playlists (alias: ls)
10 #[command(alias = "ls")]
11 List {
12 /// Number of playlists to return (default 20, max 50)
13 #[arg(long, short = 'l', default_value_t = DEFAULT_LIMIT)]
14 limit: u8,
15 /// Offset for pagination
16 #[arg(long, short = 'o', default_value_t = DEFAULT_OFFSET)]
17 offset: u32,
18 },
19 /// Get playlist details
20 Get {
21 /// Playlist ID or URL
22 playlist: String,
23 },
24 /// Create a new playlist
25 Create {
26 /// Playlist name
27 name: String,
28 /// Playlist description
29 #[arg(long, short = 'd')]
30 description: Option<String>,
31 /// Make playlist public
32 #[arg(long)]
33 public: bool,
34 },
35 /// Add tracks to a playlist
36 Add {
37 /// Playlist ID, URL, or pin alias
38 playlist: String,
39 /// Track URIs to add (e.g., spotify:track:xxx)
40 uris: Vec<String>,
41 /// Add the currently playing track
42 #[arg(long, short = 'n')]
43 now_playing: bool,
44 /// Position to insert tracks (default: end)
45 #[arg(long, short = 'p')]
46 position: Option<u32>,
47 /// Show what would be done without making changes
48 #[arg(long)]
49 dry_run: bool,
50 },
51 /// Remove tracks from a playlist
52 Remove {
53 /// Playlist ID, URL, or pin alias
54 playlist: String,
55 /// Track URIs to remove
56 #[arg(required = true)]
57 uris: Vec<String>,
58 /// Show what would be done without making changes
59 #[arg(long)]
60 dry_run: bool,
61 },
62 /// Edit playlist details
63 Edit {
64 /// Playlist ID, URL, or pin alias
65 playlist: String,
66 /// New playlist name
67 #[arg(long, short = 'n')]
68 name: Option<String>,
69 /// New playlist description
70 #[arg(long, short = 'd')]
71 description: Option<String>,
72 /// Make playlist public
73 #[arg(long, conflicts_with = "private")]
74 public: bool,
75 /// Make playlist private
76 #[arg(long, conflicts_with = "public")]
77 private: bool,
78 },
79 /// Reorder tracks in a playlist
80 Reorder {
81 /// Playlist ID, URL, or pin alias
82 playlist: String,
83 /// Position of first track to move (0-indexed)
84 #[arg(long, short = 'f')]
85 from: u32,
86 /// Position to move tracks to (0-indexed)
87 #[arg(long, short = 't')]
88 to: u32,
89 /// Number of tracks to move (default: 1)
90 #[arg(long, short = 'c', default_value = "1")]
91 count: u32,
92 },
93 /// Follow a playlist
94 Follow {
95 /// Playlist ID or URL
96 playlist: String,
97 /// Add to profile publicly
98 #[arg(long)]
99 public: bool,
100 },
101 /// Unfollow a playlist
102 Unfollow {
103 /// Playlist ID or URL
104 playlist: String,
105 },
106 /// Duplicate a playlist
107 Duplicate {
108 /// Source playlist ID, URL, or pin alias
109 playlist: String,
110 /// Name for the new playlist
111 #[arg(long, short = 'n')]
112 name: Option<String>,
113 },
114 /// Get playlist cover image URL
115 Cover {
116 /// Playlist ID, URL, or pin alias
117 playlist: String,
118 },
119 /// Get another user's playlists
120 User {
121 /// Spotify username
122 user_id: String,
123 },
124 /// Remove duplicate tracks from a playlist (alias: dedup)
125 #[command(alias = "dedup")]
126 Deduplicate {
127 /// Playlist ID, URL, or pin alias
128 playlist: String,
129 /// Show what would be done without making changes
130 #[arg(long)]
131 dry_run: bool,
132 },
133}