UNPKG

kui-shell

Version:

This is the monorepo for Kui, the hybrid command-line/GUI electron-based Kubernetes tool

56 lines 2.23 kB
"use strict"; 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 read_1 = require("../../lib/read"); const usage = (command) => ({ command, strict: command, required: [{ name: 'pipelineName', docs: 'Name of the pipeline' }], optional: [ { name: 'taskName', docs: 'Name of the task', positional: true }, { name: '--file', alias: '-f', docs: 'Path to resource specification' } ] }); const getTask = (cmd) => (command) => __awaiter(void 0, void 0, void 0, function* () { const pipelineName = command.argvNoOptions[command.argvNoOptions.indexOf(cmd) + 1]; const taskName = command.argvNoOptions[command.argvNoOptions.indexOf(cmd) + 2]; const task = yield read_1.fetchTask(command, pipelineName, taskName, command.parsedOptions.f); if (!task) { const err = new Error('task not found'); err.code = 404; throw err; } else if (!taskName) { return task; } else { return { type: 'custom', isEntity: true, prettyType: 'task', name: taskName, packageName: pipelineName, contentType: 'yaml', content: task }; } }); exports.default = (commandTree) => { commandTree.listen('/tekton/get/task', getTask('task'), { usage: usage('task'), noAuthOk: true }); commandTree.listen('/tekton/get/tasks', getTask('tasks'), { usage: usage('tasks'), noAuthOk: true }); }; //# sourceMappingURL=task.js.map