@sap/cli-core
Version:
Command-Line Interface (CLI) Core Module
31 lines (30 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const discovery_1 = require("../../../discovery");
const logger_1 = require("../../../logger");
const handler_1 = require("../../handler");
const show = async () => async () => {
const { output } = (0, logger_1.get)("commands.show");
const metadata = await (0, discovery_1.getMetadata)();
if (metadata.length === 0) {
output("Local CLI cache is empty");
throw new Error("local CLI cache is empty");
}
else {
output(JSON.stringify(metadata.map((m) => {
const addedAt = new Date();
addedAt.setTime(m.addedAt);
return {
tenant: m.tenant,
addedAt: addedAt.toLocaleString(),
};
}), null, 2));
}
};
const showCommand = {
type: "command",
command: "show",
description: "display local CLI cache entries",
handler: (0, handler_1.createNextHandler)("command.config.cache.show", (0, handler_1.createParseArgumentsHandler)(), show),
};
exports.default = showCommand;