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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Player-related command definitions.
use clap::Subcommand;
#[derive(Subcommand)]
pub enum PlayerCommand {
/// Skip to next track (alias: n)
#[command(alias = "n")]
Next,
/// Skip to previous track (alias: prev)
#[command(alias = "prev")]
Previous,
/// Toggle playback (play/pause) (alias: t)
#[command(alias = "t")]
Toggle,
/// Start or resume playback
Play {
/// Play a specific Spotify URI (track, album, playlist, etc.)
#[arg(long, short = 'u')]
uri: Option<String>,
/// Play a pinned resource by alias
#[arg(long, short = 'p')]
pin: Option<String>,
},
/// Pause playback
Pause,
/// Get current playback status (alias: st)
#[command(alias = "st")]
Status {
/// Output only the ID (for piping): track, album, or artist
#[arg(long, value_parser = ["track", "album", "artist"])]
id_only: Option<String>,
},
/// Manage playback devices (alias: dev)
#[command(alias = "dev")]
Devices {
#[command(subcommand)]
command: DevicesCommand,
},
/// Manage playback queue (alias: q)
#[command(alias = "q")]
Queue {
#[command(subcommand)]
command: QueueCommand,
},
/// Seek to position in current track
Seek {
/// Position: seconds (90), time (1:30), or explicit (90s, 5000ms)
position: String,
},
/// Set repeat mode (alias: rep)
#[command(alias = "rep")]
Repeat {
/// Repeat mode: off, track, or context
#[arg(value_parser = ["off", "track", "context"])]
mode: String,
},
/// Set playback volume (alias: vol)
#[command(alias = "vol")]
Volume {
/// Volume percentage (0-100)
#[arg(value_parser = clap::value_parser!(u8).range(0..=100))]
percent: u8,
},
/// Toggle shuffle mode (alias: sh)
#[command(alias = "sh")]
Shuffle {
/// Shuffle state: on or off
#[arg(value_parser = ["on", "off"])]
state: String,
},
/// Get recently played tracks (alias: rec)
#[command(alias = "rec")]
Recent,
}
#[derive(Subcommand)]
pub enum DevicesCommand {
/// List available devices
List,
/// Transfer playback to a device
Transfer {
/// Device ID or name
device: String,
},
}
#[derive(Subcommand)]
pub enum QueueCommand {
/// List current queue (alias: ls)
#[command(alias = "ls")]
List,
/// Add item to queue
Add {
/// Spotify URI (e.g., spotify:track:xxx)
uri: Option<String>,
/// Add the currently playing track
#[arg(long, short = 'n')]
now_playing: bool,
},
}