@canra/cli 0.3.0 → 0.4.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/canra.js +21 -17
- package/package.json +1 -1
package/canra.js
CHANGED
|
@@ -306,9 +306,13 @@ async function cmdSearch(query) {
|
|
|
306
306
|
console.log(`${"-".repeat(nameWidth)} ${"-".repeat(versionWidth)} ${"-".repeat(descWidth)}`);
|
|
307
307
|
|
|
308
308
|
for (const spec of specs) {
|
|
309
|
-
const name = (spec.name
|
|
310
|
-
const version = (spec.version
|
|
311
|
-
const desc = (
|
|
309
|
+
const name = printable(spec.name).padEnd(nameWidth).slice(0, nameWidth);
|
|
310
|
+
const version = printable(spec.version).padEnd(versionWidth).slice(0, versionWidth);
|
|
311
|
+
const desc = printable(
|
|
312
|
+
String(spec.description || spec.title || "")
|
|
313
|
+
.replace(/\s+/g, " ")
|
|
314
|
+
.trim(),
|
|
315
|
+
).slice(0, descWidth);
|
|
312
316
|
console.log(`${name} ${version} ${desc}`);
|
|
313
317
|
}
|
|
314
318
|
|
|
@@ -352,12 +356,12 @@ async function cmdPublish(args) {
|
|
|
352
356
|
});
|
|
353
357
|
if (!res.ok) {
|
|
354
358
|
const body = await res.text();
|
|
355
|
-
console.error(`Error: ${res.status} - ${body}`);
|
|
359
|
+
console.error(`Error: ${res.status} - ${printable(body)}`);
|
|
356
360
|
process.exit(1);
|
|
357
361
|
}
|
|
358
362
|
|
|
359
363
|
const spec = await res.json();
|
|
360
|
-
console.log(`Published ${spec.name}@${spec.version}`);
|
|
364
|
+
console.log(`Published ${printable(spec.name)}@${printable(spec.version)}`);
|
|
361
365
|
}
|
|
362
366
|
|
|
363
367
|
async function cmdLogin() {
|
|
@@ -419,9 +423,9 @@ async function cmdWhoami() {
|
|
|
419
423
|
process.exit(1);
|
|
420
424
|
}
|
|
421
425
|
const me = await res.json();
|
|
422
|
-
console.log(me.user);
|
|
426
|
+
console.log(printable(me.user));
|
|
423
427
|
console.log(` Registry: ${registry}`);
|
|
424
|
-
if (me.scopes?.length) console.log(` Scopes: ${me.scopes.join(", ")}`);
|
|
428
|
+
if (me.scopes?.length) console.log(` Scopes: ${printable(me.scopes.join(", "))}`);
|
|
425
429
|
}
|
|
426
430
|
|
|
427
431
|
async function cmdInfo(specArg) {
|
|
@@ -446,16 +450,16 @@ async function cmdInfo(specArg) {
|
|
|
446
450
|
}
|
|
447
451
|
|
|
448
452
|
const spec = await res.json();
|
|
449
|
-
console.log(`${ref.owner}/${ref.name}@${spec.version}`);
|
|
450
|
-
if (spec.title) console.log(` Title: ${spec.title}`);
|
|
451
|
-
if (spec.status) console.log(` Status: ${spec.status}`);
|
|
452
|
-
if (spec.difficulty) console.log(` Difficulty: ${spec.difficulty}`);
|
|
453
|
-
if (spec.tags?.length) console.log(` Tags: ${spec.tags.join(", ")}`);
|
|
454
|
-
if (spec.functions?.length) console.log(` Functions: ${spec.functions.join(", ")}`);
|
|
455
|
-
if (spec.types?.length) console.log(` Types: ${spec.types.join(", ")}`);
|
|
456
|
-
if (spec.test_vectors_inline) console.log(` Test vectors: ${spec.test_vectors_inline} inline`);
|
|
457
|
-
if (spec.owner) console.log(` Owner: ${spec.owner}`);
|
|
458
|
-
if (spec.updated_at) console.log(` Updated: ${spec.updated_at}`);
|
|
453
|
+
console.log(`${ref.owner}/${ref.name}@${printable(spec.version)}`);
|
|
454
|
+
if (spec.title) console.log(` Title: ${printable(spec.title)}`);
|
|
455
|
+
if (spec.status) console.log(` Status: ${printable(spec.status)}`);
|
|
456
|
+
if (spec.difficulty) console.log(` Difficulty: ${printable(spec.difficulty)}`);
|
|
457
|
+
if (spec.tags?.length) console.log(` Tags: ${printable(spec.tags.join(", "))}`);
|
|
458
|
+
if (spec.functions?.length) console.log(` Functions: ${printable(spec.functions.join(", "))}`);
|
|
459
|
+
if (spec.types?.length) console.log(` Types: ${printable(spec.types.join(", "))}`);
|
|
460
|
+
if (spec.test_vectors_inline) console.log(` Test vectors: ${printable(spec.test_vectors_inline)} inline`);
|
|
461
|
+
if (spec.owner) console.log(` Owner: ${printable(spec.owner)}`);
|
|
462
|
+
if (spec.updated_at) console.log(` Updated: ${printable(spec.updated_at)}`);
|
|
459
463
|
}
|
|
460
464
|
|
|
461
465
|
// The server rejects more than MAX_REFS (website/outdated.js) entries per request.
|