@tolinax/ayoune-cli 2024.2.12 → 2024.2.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.
|
@@ -44,7 +44,7 @@ export async function handleCollectionOperation(module, collection, entry, opts)
|
|
|
44
44
|
console.log(yaml.dump(editContent));
|
|
45
45
|
break;
|
|
46
46
|
case "download":
|
|
47
|
-
res = await apiCallHandler(`${module}/${collection.toLowerCase()}/${entry}?responseFormat
|
|
47
|
+
res = await apiCallHandler(`${module}/${collection.toLowerCase()}/${entry}?responseFormat=${opts.responseFormat}}`);
|
|
48
48
|
spinner.success({
|
|
49
49
|
text: `Got entry ${res.payload.name} - Took ${res.meta.responseTime} ms`,
|
|
50
50
|
});
|
|
@@ -53,7 +53,12 @@ export async function handleCollectionOperation(module, collection, entry, opts)
|
|
|
53
53
|
const folder = await promptFilePath(collection);
|
|
54
54
|
await mkdirp(folder);
|
|
55
55
|
const fileName = await promptFileName(`${collection}_${editContent._id}.${opts.responseFormat}`);
|
|
56
|
-
|
|
56
|
+
const contentToWrite = opts.responseFormat === "yaml"
|
|
57
|
+
? yaml.dump(editContent)
|
|
58
|
+
: opts.responseFormat === "csv"
|
|
59
|
+
? JSON.stringify(editContent, null, 4)
|
|
60
|
+
: editContent;
|
|
61
|
+
await writeFile(path.join(folder, fileName), contentToWrite, {
|
|
57
62
|
encoding: "utf8",
|
|
58
63
|
});
|
|
59
64
|
break;
|