@kud/qobuz-cli 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +207 -95
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -48,15 +48,52 @@ var formatDuration = (seconds) => {
|
|
|
48
48
|
const remainder = String(seconds % 60).padStart(2, "0");
|
|
49
49
|
return `${minutes}:${remainder}`;
|
|
50
50
|
};
|
|
51
|
-
var
|
|
51
|
+
var linkFor = (links, type, id) => {
|
|
52
52
|
const builders = {
|
|
53
|
-
album: (value) =>
|
|
54
|
-
track: (value) =>
|
|
55
|
-
playlist: (value) =>
|
|
56
|
-
artist: (value) =>
|
|
53
|
+
album: (value) => links.album(value),
|
|
54
|
+
track: (value) => links.track(Number(value)),
|
|
55
|
+
playlist: (value) => links.playlist(Number(value)),
|
|
56
|
+
artist: (value) => links.artist(Number(value))
|
|
57
57
|
};
|
|
58
58
|
return builders[type]?.(id);
|
|
59
59
|
};
|
|
60
|
+
var deepLinkFor = (client, type, id) => linkFor(client.deepLink, type, id);
|
|
61
|
+
var appLinkFor = (client, type, id) => linkFor(client.appLink, type, id);
|
|
62
|
+
|
|
63
|
+
// src/ui.ts
|
|
64
|
+
var ESC2 = String.fromCharCode(27);
|
|
65
|
+
var colour = process.stdout.isTTY;
|
|
66
|
+
var ansi = new RegExp(`${ESC2}\\[[0-9;]*m`, "g");
|
|
67
|
+
var style = (open2, close) => (text) => colour ? `${ESC2}[${open2}m${text}${ESC2}[${close}m` : text;
|
|
68
|
+
var bold2 = style("1", "22");
|
|
69
|
+
var dim = style("2", "22");
|
|
70
|
+
var accent = style("36", "39");
|
|
71
|
+
var muted = style("90", "39");
|
|
72
|
+
var good = style("32", "39");
|
|
73
|
+
var heading = (text) => console.log(`
|
|
74
|
+
${bold2(text)}`);
|
|
75
|
+
var success = (text) => console.log(`${good("\u2713")} ${text}`);
|
|
76
|
+
var link = (url2) => `${dim("\u2197")} ${accent(url2)}`;
|
|
77
|
+
var visibleWidth = (text) => text.replace(ansi, "").length;
|
|
78
|
+
var columns = (rows, aligns = []) => {
|
|
79
|
+
const colCount = Math.max(0, ...rows.map((row) => row.length));
|
|
80
|
+
const widths = Array.from(
|
|
81
|
+
{ length: colCount },
|
|
82
|
+
(_, i) => Math.max(0, ...rows.map((row) => visibleWidth(row[i] ?? "")))
|
|
83
|
+
);
|
|
84
|
+
const pad = (cell, i) => {
|
|
85
|
+
const gap = " ".repeat(Math.max(0, (widths[i] ?? 0) - visibleWidth(cell)));
|
|
86
|
+
return aligns[i] === "right" ? gap + cell : cell + gap;
|
|
87
|
+
};
|
|
88
|
+
return rows.map((row) => ` ${row.map(pad).join(" ").trimEnd()}`).join("\n");
|
|
89
|
+
};
|
|
90
|
+
var BLOCKS = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589"];
|
|
91
|
+
var bar = (value, max, width = 22) => {
|
|
92
|
+
const units = max > 0 ? value / max * width : 0;
|
|
93
|
+
const full = Math.floor(units);
|
|
94
|
+
const partial = BLOCKS[Math.round((units - full) * 8)] ?? "";
|
|
95
|
+
return `${"\u2588".repeat(full)}${partial}`.padEnd(width);
|
|
96
|
+
};
|
|
60
97
|
|
|
61
98
|
// src/commands/album.ts
|
|
62
99
|
var album = defineCommand({
|
|
@@ -67,12 +104,16 @@ var album = defineCommand({
|
|
|
67
104
|
run: async ({ args: args2 }) => {
|
|
68
105
|
const client = await connect();
|
|
69
106
|
const album2 = await client.albums.get(args2.id);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
75
|
-
console.log(`
|
|
107
|
+
const meta = [
|
|
108
|
+
`${album2.tracksCount ?? "?"} tracks`,
|
|
109
|
+
`released ${album2.releaseDate ?? "?"}`,
|
|
110
|
+
album2.hires ? "Hi-Res" : void 0
|
|
111
|
+
].filter(Boolean).join(" \xB7 ");
|
|
112
|
+
console.log(`
|
|
113
|
+
${bold2(`\u{1F4BF} ${album2.title}`)}`);
|
|
114
|
+
console.log(` ${dim(`by ${album2.artist?.name ?? "?"}`)}`);
|
|
115
|
+
console.log(` ${dim(meta)}`);
|
|
116
|
+
console.log(` ${link(client.deepLink.album(album2.id))}`);
|
|
76
117
|
}
|
|
77
118
|
});
|
|
78
119
|
|
|
@@ -86,10 +127,11 @@ var artist = defineCommand2({
|
|
|
86
127
|
run: async ({ args: args2 }) => {
|
|
87
128
|
const client = await connect();
|
|
88
129
|
const artist2 = await client.artists.get(Number(args2.id));
|
|
89
|
-
console.log(
|
|
130
|
+
console.log(`
|
|
131
|
+
${bold2(`\u{1F3A4} ${artist2.name}`)}`);
|
|
90
132
|
if (artist2.albumsCount !== void 0)
|
|
91
|
-
console.log(`${artist2.albumsCount} albums`);
|
|
92
|
-
console.log(`
|
|
133
|
+
console.log(` ${dim(`${artist2.albumsCount} albums`)}`);
|
|
134
|
+
console.log(` ${link(client.deepLink.artist(artist2.id))}`);
|
|
93
135
|
}
|
|
94
136
|
});
|
|
95
137
|
|
|
@@ -107,16 +149,41 @@ var list = defineCommand3({
|
|
|
107
149
|
run: async ({ args: args2 }) => {
|
|
108
150
|
const client = await connect();
|
|
109
151
|
const favourites = await client.favourites.list(args2.type);
|
|
110
|
-
|
|
152
|
+
if (favourites.albums.length) {
|
|
153
|
+
heading("\u{1F4BF} Albums");
|
|
111
154
|
console.log(
|
|
112
|
-
|
|
155
|
+
columns(
|
|
156
|
+
favourites.albums.map((album2) => [
|
|
157
|
+
accent(album2.title),
|
|
158
|
+
dim(album2.artist?.name ?? "?"),
|
|
159
|
+
muted(String(album2.id))
|
|
160
|
+
])
|
|
161
|
+
)
|
|
113
162
|
);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
163
|
+
}
|
|
164
|
+
if (favourites.artists.length) {
|
|
165
|
+
heading("\u{1F3A4} Artists");
|
|
166
|
+
console.log(
|
|
167
|
+
columns(
|
|
168
|
+
favourites.artists.map((artist2) => [
|
|
169
|
+
accent(artist2.name),
|
|
170
|
+
muted(String(artist2.id))
|
|
171
|
+
])
|
|
172
|
+
)
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
if (favourites.tracks.length) {
|
|
176
|
+
heading("\u{1F3B5} Tracks");
|
|
117
177
|
console.log(
|
|
118
|
-
|
|
178
|
+
columns(
|
|
179
|
+
favourites.tracks.map((track2) => [
|
|
180
|
+
accent(track2.title),
|
|
181
|
+
dim(track2.artist?.name ?? "?"),
|
|
182
|
+
muted(String(track2.id))
|
|
183
|
+
])
|
|
184
|
+
)
|
|
119
185
|
);
|
|
186
|
+
}
|
|
120
187
|
}
|
|
121
188
|
});
|
|
122
189
|
var add = defineCommand3({
|
|
@@ -136,7 +203,7 @@ var add = defineCommand3({
|
|
|
136
203
|
run: async ({ args: args2 }) => {
|
|
137
204
|
const client = await connect();
|
|
138
205
|
await client.favourites.add(args2.type, args2.id);
|
|
139
|
-
|
|
206
|
+
success(`added ${args2.type} ${args2.id} to favourites`);
|
|
140
207
|
}
|
|
141
208
|
});
|
|
142
209
|
var remove = defineCommand3({
|
|
@@ -156,7 +223,7 @@ var remove = defineCommand3({
|
|
|
156
223
|
run: async ({ args: args2 }) => {
|
|
157
224
|
const client = await connect();
|
|
158
225
|
await client.favourites.remove(args2.type, args2.id);
|
|
159
|
-
|
|
226
|
+
success(`removed ${args2.type} ${args2.id} from favourites`);
|
|
160
227
|
}
|
|
161
228
|
});
|
|
162
229
|
var fav = defineCommand3({
|
|
@@ -184,16 +251,16 @@ var createPrompts = () => {
|
|
|
184
251
|
(resolve) => rl.question(question, (answer) => resolve(answer.trim()))
|
|
185
252
|
);
|
|
186
253
|
const askHidden = (question) => new Promise((resolve) => {
|
|
187
|
-
let
|
|
254
|
+
let muted2 = false;
|
|
188
255
|
rl._writeToOutput = (chunk) => {
|
|
189
|
-
if (!
|
|
256
|
+
if (!muted2) process.stdout.write(chunk);
|
|
190
257
|
};
|
|
191
258
|
rl.question(question, (answer) => {
|
|
192
259
|
rl._writeToOutput = (chunk) => process.stdout.write(chunk);
|
|
193
260
|
process.stdout.write("\n");
|
|
194
261
|
resolve(answer);
|
|
195
262
|
});
|
|
196
|
-
|
|
263
|
+
muted2 = true;
|
|
197
264
|
});
|
|
198
265
|
return { ask, askHidden, close: () => rl.close() };
|
|
199
266
|
};
|
|
@@ -217,8 +284,8 @@ var copyToClipboard = async (text) => {
|
|
|
217
284
|
};
|
|
218
285
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
219
286
|
var countdownAndOpen = async (url2, seconds = 3) => {
|
|
220
|
-
for (const
|
|
221
|
-
process.stdout.write(`\r Opening ${url2} in ${
|
|
287
|
+
for (const n2 of Array.from({ length: seconds }, (_, i) => seconds - i)) {
|
|
288
|
+
process.stdout.write(`\r Opening ${url2} in ${n2}\u2026 `);
|
|
222
289
|
await sleep(1e3);
|
|
223
290
|
}
|
|
224
291
|
process.stdout.write(`\r Opening ${url2} now.${" ".repeat(20)}
|
|
@@ -301,13 +368,13 @@ var open = defineCommand6({
|
|
|
301
368
|
},
|
|
302
369
|
run: async ({ args: args2 }) => {
|
|
303
370
|
const client = await connect();
|
|
304
|
-
const
|
|
305
|
-
if (!
|
|
371
|
+
const link2 = appLinkFor(client, args2.type, args2.id);
|
|
372
|
+
if (!link2) {
|
|
306
373
|
console.error("type must be one of: album, track, playlist, artist");
|
|
307
374
|
process.exit(1);
|
|
308
375
|
}
|
|
309
|
-
console.log(`opening ${
|
|
310
|
-
await openUrl(
|
|
376
|
+
console.log(`opening ${link2}`);
|
|
377
|
+
await openUrl(link2);
|
|
311
378
|
}
|
|
312
379
|
});
|
|
313
380
|
|
|
@@ -390,11 +457,17 @@ var list2 = defineCommand8({
|
|
|
390
457
|
run: async () => {
|
|
391
458
|
const client = await connect();
|
|
392
459
|
const playlists = await client.playlists.listForUser();
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
460
|
+
if (!playlists.length) return;
|
|
461
|
+
heading("\u{1F4DD} Playlists");
|
|
462
|
+
console.log(
|
|
463
|
+
columns(
|
|
464
|
+
playlists.map((playlist2) => [
|
|
465
|
+
accent(playlist2.name),
|
|
466
|
+
dim(`${playlist2.tracksCount ?? 0} tracks`),
|
|
467
|
+
muted(String(playlist2.id))
|
|
468
|
+
])
|
|
469
|
+
)
|
|
470
|
+
);
|
|
398
471
|
}
|
|
399
472
|
});
|
|
400
473
|
var show = defineCommand8({
|
|
@@ -405,9 +478,11 @@ var show = defineCommand8({
|
|
|
405
478
|
run: async ({ args: args2 }) => {
|
|
406
479
|
const client = await connect();
|
|
407
480
|
const playlist2 = await client.playlists.get(Number(args2.id));
|
|
408
|
-
console.log(
|
|
409
|
-
|
|
410
|
-
console.log(`
|
|
481
|
+
console.log(`
|
|
482
|
+
${bold2(`\u{1F4DD} ${playlist2.name}`)}`);
|
|
483
|
+
console.log(` ${dim(`${playlist2.tracksCount ?? 0} tracks`)}`);
|
|
484
|
+
if (playlist2.description) console.log(` ${dim(playlist2.description)}`);
|
|
485
|
+
console.log(` ${link(client.deepLink.playlist(playlist2.id))}`);
|
|
411
486
|
}
|
|
412
487
|
});
|
|
413
488
|
var create = defineCommand8({
|
|
@@ -426,7 +501,7 @@ var create = defineCommand8({
|
|
|
426
501
|
name: args2.name,
|
|
427
502
|
isPublic: args2.public
|
|
428
503
|
});
|
|
429
|
-
|
|
504
|
+
success(`created playlist "${playlist2.name}" [${playlist2.id}]`);
|
|
430
505
|
}
|
|
431
506
|
});
|
|
432
507
|
var add2 = defineCommand8({
|
|
@@ -444,7 +519,7 @@ var add2 = defineCommand8({
|
|
|
444
519
|
await client.playlists.addTracks(Number(args2.playlist), [
|
|
445
520
|
Number(args2.track)
|
|
446
521
|
]);
|
|
447
|
-
|
|
522
|
+
success(`added track ${args2.track} to playlist ${args2.playlist}`);
|
|
448
523
|
}
|
|
449
524
|
});
|
|
450
525
|
var remove2 = defineCommand8({
|
|
@@ -455,7 +530,7 @@ var remove2 = defineCommand8({
|
|
|
455
530
|
run: async ({ args: args2 }) => {
|
|
456
531
|
const client = await connect();
|
|
457
532
|
await client.playlists.remove(Number(args2.id));
|
|
458
|
-
|
|
533
|
+
success(`deleted playlist ${args2.id}`);
|
|
459
534
|
}
|
|
460
535
|
});
|
|
461
536
|
var playlist = defineCommand8({
|
|
@@ -484,25 +559,41 @@ var search = defineCommand9({
|
|
|
484
559
|
limit: Number(args2.limit)
|
|
485
560
|
});
|
|
486
561
|
if (results.albums.length) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
562
|
+
heading("\u{1F4BF} Albums");
|
|
563
|
+
console.log(
|
|
564
|
+
columns(
|
|
565
|
+
results.albums.map((album2) => [
|
|
566
|
+
accent(album2.title),
|
|
567
|
+
dim(album2.artist?.name ?? "?"),
|
|
568
|
+
muted(String(album2.id))
|
|
569
|
+
])
|
|
570
|
+
)
|
|
571
|
+
);
|
|
493
572
|
}
|
|
494
573
|
if (results.artists.length) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
574
|
+
heading("\u{1F3A4} Artists");
|
|
575
|
+
console.log(
|
|
576
|
+
columns(
|
|
577
|
+
results.artists.map((artist2) => [
|
|
578
|
+
accent(artist2.name),
|
|
579
|
+
muted(String(artist2.id))
|
|
580
|
+
])
|
|
581
|
+
)
|
|
582
|
+
);
|
|
498
583
|
}
|
|
499
584
|
if (results.tracks.length) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
585
|
+
heading("\u{1F3B5} Tracks");
|
|
586
|
+
console.log(
|
|
587
|
+
columns(
|
|
588
|
+
results.tracks.map((track2) => [
|
|
589
|
+
accent(track2.title),
|
|
590
|
+
dim(track2.artist?.name ?? "?"),
|
|
591
|
+
dim(formatDuration(track2.duration)),
|
|
592
|
+
muted(String(track2.id))
|
|
593
|
+
]),
|
|
594
|
+
["left", "left", "right", "left"]
|
|
595
|
+
)
|
|
596
|
+
);
|
|
506
597
|
}
|
|
507
598
|
}
|
|
508
599
|
});
|
|
@@ -520,21 +611,35 @@ var similar = defineCommand10({
|
|
|
520
611
|
run: async ({ args: args2 }) => {
|
|
521
612
|
const client = await connect();
|
|
522
613
|
const artists = await client.artists.getSimilar(Number(args2.id));
|
|
523
|
-
|
|
614
|
+
if (!artists.length) return;
|
|
615
|
+
heading("\u{1F3A4} Similar artists");
|
|
616
|
+
console.log(
|
|
617
|
+
columns(
|
|
618
|
+
artists.map((artist2) => [
|
|
619
|
+
accent(artist2.name),
|
|
620
|
+
muted(String(artist2.id))
|
|
621
|
+
])
|
|
622
|
+
)
|
|
623
|
+
);
|
|
524
624
|
}
|
|
525
625
|
});
|
|
526
626
|
|
|
527
627
|
// src/commands/stats.ts
|
|
528
628
|
import { defineCommand as defineCommand11 } from "citty";
|
|
529
629
|
import { readLibraryStats } from "@kud/qobuz";
|
|
630
|
+
var n = (value) => value.toLocaleString("en-US");
|
|
530
631
|
var pct = (count, total) => total ? `${Math.round(1e3 * count / total) / 10}%` : "";
|
|
531
|
-
var
|
|
632
|
+
var chart = (title, rows, scaleMax) => {
|
|
532
633
|
if (!rows.length) return;
|
|
533
|
-
const
|
|
634
|
+
const max = scaleMax ?? Math.max(...rows.map((r) => r.value));
|
|
635
|
+
const labelWidth = Math.max(...rows.map((r) => r.label.length));
|
|
636
|
+
const valueWidth = Math.max(...rows.map((r) => n(r.value).length));
|
|
534
637
|
console.log(`
|
|
535
|
-
${title}`);
|
|
536
|
-
for (const
|
|
537
|
-
|
|
638
|
+
${bold2(title)}`);
|
|
639
|
+
for (const { label, value, suffix } of rows) {
|
|
640
|
+
const line = ` ${label.padEnd(labelWidth)} ${accent(bar(value, max))} ${dim(n(value).padStart(valueWidth))}`;
|
|
641
|
+
console.log(suffix ? `${line} ${dim(suffix)}` : line);
|
|
642
|
+
}
|
|
538
643
|
};
|
|
539
644
|
var stats = defineCommand11({
|
|
540
645
|
meta: {
|
|
@@ -554,30 +659,34 @@ var stats = defineCommand11({
|
|
|
554
659
|
}
|
|
555
660
|
const { totals, quality, topGenres, topLabels, topArtists, recentlyAdded } = data;
|
|
556
661
|
console.log(
|
|
557
|
-
|
|
662
|
+
`${bold2("\u{1F4CA} Collection")} ${dim(
|
|
663
|
+
`${n(totals.offlineAlbums)} albums \xB7 ${n(totals.offlineArtists)} artists \xB7 ${n(totals.offlineTracks)} offline \xB7 ${n(totals.savedTracks)} saved`
|
|
664
|
+
)}`
|
|
558
665
|
);
|
|
559
|
-
|
|
560
|
-
"Quality
|
|
561
|
-
quality.map((q) =>
|
|
562
|
-
`${q.bitDepth}-bit`,
|
|
563
|
-
|
|
564
|
-
|
|
666
|
+
chart(
|
|
667
|
+
"\u{1F39A}\uFE0F Quality \xB7 offline tracks",
|
|
668
|
+
quality.map((q) => ({
|
|
669
|
+
label: `${q.bitDepth}-bit`,
|
|
670
|
+
value: q.count,
|
|
671
|
+
suffix: pct(q.count, totals.offlineTracks)
|
|
672
|
+
})),
|
|
673
|
+
totals.offlineTracks
|
|
565
674
|
);
|
|
566
|
-
|
|
567
|
-
"Top genres",
|
|
568
|
-
topGenres.map((g) =>
|
|
675
|
+
chart(
|
|
676
|
+
"\u{1F3B8} Top genres",
|
|
677
|
+
topGenres.map((g) => ({ label: g.name, value: g.count }))
|
|
569
678
|
);
|
|
570
|
-
|
|
571
|
-
"Top artists
|
|
572
|
-
topArtists.map((a) =>
|
|
679
|
+
chart(
|
|
680
|
+
"\u{1F3A4} Top artists \xB7 by albums",
|
|
681
|
+
topArtists.map((a) => ({ label: a.name, value: a.count }))
|
|
573
682
|
);
|
|
574
|
-
|
|
575
|
-
"Top labels",
|
|
576
|
-
topLabels.map((l) =>
|
|
683
|
+
chart(
|
|
684
|
+
"\u{1F3F7}\uFE0F Top labels",
|
|
685
|
+
topLabels.map((l) => ({ label: l.name, value: l.count }))
|
|
577
686
|
);
|
|
578
|
-
|
|
579
|
-
"Added recently",
|
|
580
|
-
recentlyAdded.map((m) =>
|
|
687
|
+
chart(
|
|
688
|
+
"\u{1F4C5} Added recently",
|
|
689
|
+
recentlyAdded.map((m) => ({ label: m.month, value: m.count }))
|
|
581
690
|
);
|
|
582
691
|
}
|
|
583
692
|
});
|
|
@@ -592,14 +701,17 @@ var track = defineCommand12({
|
|
|
592
701
|
run: async ({ args: args2 }) => {
|
|
593
702
|
const client = await connect();
|
|
594
703
|
const track2 = await client.tracks.get(Number(args2.id));
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
);
|
|
704
|
+
const meta = [
|
|
705
|
+
formatDuration(track2.duration),
|
|
706
|
+
track2.hires ? "Hi-Res" : void 0
|
|
707
|
+
].filter(Boolean).join(" \xB7 ");
|
|
708
|
+
console.log(`
|
|
709
|
+
${bold2(`\u{1F3B5} ${track2.title}`)}`);
|
|
599
710
|
console.log(
|
|
600
|
-
|
|
711
|
+
` ${dim(`by ${track2.artist?.name ?? "?"}${track2.album ? ` \xB7 ${track2.album.title}` : ""}`)}`
|
|
601
712
|
);
|
|
602
|
-
console.log(`
|
|
713
|
+
if (meta) console.log(` ${dim(meta)}`);
|
|
714
|
+
console.log(` ${link(client.deepLink.track(track2.id))}`);
|
|
603
715
|
}
|
|
604
716
|
});
|
|
605
717
|
|
|
@@ -621,12 +733,12 @@ var specificLink = (client, type, id) => {
|
|
|
621
733
|
console.error("usage: qobuz url <album|track|playlist|artist> <id>");
|
|
622
734
|
process.exit(1);
|
|
623
735
|
}
|
|
624
|
-
const
|
|
625
|
-
if (!
|
|
736
|
+
const link2 = deepLinkFor(client, type, id);
|
|
737
|
+
if (!link2) {
|
|
626
738
|
console.error("type must be one of: album, track, playlist, artist");
|
|
627
739
|
process.exit(1);
|
|
628
740
|
}
|
|
629
|
-
return
|
|
741
|
+
return link2;
|
|
630
742
|
};
|
|
631
743
|
var url = defineCommand13({
|
|
632
744
|
meta: {
|
|
@@ -652,13 +764,13 @@ var url = defineCommand13({
|
|
|
652
764
|
},
|
|
653
765
|
run: async ({ args: args2 }) => {
|
|
654
766
|
const client = await connect();
|
|
655
|
-
const
|
|
767
|
+
const link2 = args2.type ? specificLink(client, args2.type, args2.id) : await currentTrackLink(client);
|
|
656
768
|
if (args2.plain) {
|
|
657
|
-
console.log(
|
|
769
|
+
console.log(link2);
|
|
658
770
|
return;
|
|
659
771
|
}
|
|
660
|
-
const copied = await copyToClipboard(
|
|
661
|
-
console.log(copied ? `\u2713 copied ${
|
|
772
|
+
const copied = await copyToClipboard(link2);
|
|
773
|
+
console.log(copied ? `\u2713 copied ${link2}` : link2);
|
|
662
774
|
}
|
|
663
775
|
});
|
|
664
776
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/qobuz-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Command-line interface for Qobuz — search, library, and quick-open in the app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"node": ">=20"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@kud/qobuz": "0.
|
|
28
|
+
"@kud/qobuz": "0.5.0",
|
|
29
29
|
"citty": "0.2.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|