@iksdev/shard-cli 0.1.12 → 0.1.13
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/bin/shard.js +14 -3
- package/package.json +1 -1
package/bin/shard.js
CHANGED
|
@@ -66,6 +66,15 @@ function isInteractive() {
|
|
|
66
66
|
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
function stripWrappingQuotes(value) {
|
|
70
|
+
let out = String(value || '').trim();
|
|
71
|
+
if (!out) return out;
|
|
72
|
+
if ((out.startsWith('"') && out.endsWith('"')) || (out.startsWith("'") && out.endsWith("'"))) {
|
|
73
|
+
out = out.slice(1, -1).trim();
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
async function askText(label, defaultValue = '') {
|
|
70
79
|
const rl = readline.createInterface({
|
|
71
80
|
input: process.stdin,
|
|
@@ -74,8 +83,8 @@ async function askText(label, defaultValue = '') {
|
|
|
74
83
|
const suffix = defaultValue ? ` [${defaultValue}]` : '';
|
|
75
84
|
const answer = await new Promise((resolve) => rl.question(`${label}${suffix}: `, resolve));
|
|
76
85
|
rl.close();
|
|
77
|
-
const trimmed =
|
|
78
|
-
return trimmed ||
|
|
86
|
+
const trimmed = stripWrappingQuotes(answer);
|
|
87
|
+
return trimmed || stripWrappingQuotes(defaultValue);
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
async function askSecret(label) {
|
|
@@ -404,7 +413,7 @@ function stableRelayFileId(absPath) {
|
|
|
404
413
|
}
|
|
405
414
|
|
|
406
415
|
async function shareFile(positionals, flags) {
|
|
407
|
-
let target = positionals[0];
|
|
416
|
+
let target = stripWrappingQuotes(positionals[0]);
|
|
408
417
|
if (!target && isInteractive()) {
|
|
409
418
|
target = await askText('Fichier a partager');
|
|
410
419
|
}
|
|
@@ -532,6 +541,8 @@ async function shareFile(positionals, flags) {
|
|
|
532
541
|
fileName,
|
|
533
542
|
fileSize: st.size,
|
|
534
543
|
mimeType,
|
|
544
|
+
// Compat backend ancien + nouveau:
|
|
545
|
+
relayClientId,
|
|
535
546
|
relayFileId
|
|
536
547
|
};
|
|
537
548
|
if (limits !== undefined && limits > 0) payload.maxDownloads = limits;
|