kui-shell
Version:
This is the monorepo for Kui, the hybrid command-line/GUI electron-based Kubernetes tool
56 lines • 2.62 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const config = [
{
name: '--config',
docs: 'An OpenShift config file',
file: true
}
];
const catalog = {
command: 'catalog',
strict: 'catalog',
docs: 'List available operators',
optional: config
};
const installed = {
command: 'installed',
strict: 'installed',
docs: 'List installed operators',
optional: config
};
exports.default = (commandTree) => __awaiter(void 0, void 0, void 0, function* () {
commandTree.subtree('/olm', {
usage: {
command: 'olm',
commandPrefix: 'olm',
available: [catalog, installed]
}
});
commandTree.listen('/olm/catalog', ({ block, parsedOptions, execOptions, REPL }) => __awaiter(void 0, void 0, void 0, function* () {
const namespace = parsedOptions.n || parsedOptions.namespace;
const getSources = `oc get OperatorSources ${namespace ? `-n ${namespace}` : '--all-namespaces'} -o=custom-columns=NAME:.metadata.name,PACKAGES:.status.packages ${parsedOptions.config ? `--config ${parsedOptions.config}` : ''}`;
return REPL.qexec(getSources, block, undefined, execOptions);
}), {
noAuthOk: true,
usage: catalog
});
commandTree.listen('/olm/installed', ({ block, parsedOptions, execOptions, REPL }) => __awaiter(void 0, void 0, void 0, function* () {
const namespace = parsedOptions.n || parsedOptions.namespace;
const getSources = `oc get ClusterServiceVersions -n ${namespace || 'default'} ${parsedOptions.config ? `--config ${parsedOptions.config}` : ''} -o=custom-columns=NAME:.metadata.name,DISPLAY:.spec.displayName,VERSION:.spec.version,STATUS:.status.phase`;
return REPL.qexec(getSources, block, undefined, execOptions);
}), {
noAuthOk: true,
usage: installed
});
});
//# sourceMappingURL=olm.js.map