UNPKG

@kui-shell/plugin-tutorials

Version:

IBM Cloud shell plugin for tutorials

168 lines 5.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const parents = ['module']; exports.entity = 'module'; exports.entities = `${exports.entity}s`; const commandPrefix = exports.entity; const projectNameAttr = 'projectName'; const importedProject = [ { name: projectNameAttr, docs: 'Name of an imported module', entity: exports.entity, implicitOK: [exports.entities] } ]; const example = (command) => `${exports.entity} ${command} <${projectNameAttr}>`; const capitalize = word => word.charAt(0).toUpperCase() + word.substring(1); const projectCommand = (command, docs, opts) => ({ strict: command, command, commandPrefix, breadcrumb: opts.breadcrumb || command, title: capitalize(command), header: docs, example: example(command), required: opts.noProjectRequired ? [] : opts.required || importedProject, optional: opts.optional, parents, related: opts.related }); exports.usage = { import: { strict: 'import', command: 'import', title: 'Import', header: 'import a Composer module from GitHub', example: `${exports.entity} import <url>`, required: [ { name: 'url', docs: 'github.com URL for the module to import', entity: exports.entity, file: true } ], optional: [ { name: '--name', docs: 'Name for the imported module; defaults to the git repo name' }, { name: '--branch', alias: '-b', docs: 'Check out a branch of the given module repository' }, { name: '--force', alias: '-f', boolean: true, docs: 'Refresh the module if it has already been imported' } ], parents }, get: projectCommand('get', 'learn more about a module', { related: [`${exports.entity} api`, `${exports.entity} deps`] }), imports: projectCommand('imports', 'discover the other modules upon which this module depends', { breadcrumb: 'Module Imports' }), deps: projectCommand('deps', 'discover the cloud services upon which this module depends', { breadcrumb: 'Service Dependencies' }), config: { strict: 'config', command: 'config', title: 'Configure', header: 'configure a module before deploying, such as setting up credentials', example: example('config'), required: importedProject, optional: [ { name: '--save', hidden: true, boolean: true, docs: 'Save an empty config' } ], parents }, deploy: { strict: 'deploy', command: 'deploy', title: 'Deploy', header: 'deploy a module', example: example('deploy'), required: importedProject, parents }, undeploy: { strict: 'undeploy', command: 'undeploy', title: 'Undeploy', header: 'undeploy a module from the cloud', example: example('undeploy'), required: importedProject, parents }, list: syn => projectCommand(syn, 'list the imported projects', { breadcrumb: 'list', noProjectRequired: true, optional: [ { name: 'moduleName', positional: true, docs: 'list the assets of a given module', entity: exports.entity }, { name: '--limit', hidden: true } ], related: [`${exports.entity} set`] }), init: projectCommand('init', 'create a new empty project', { required: [{ name: 'moduleName', docs: 'name for the new module' }], related: [`${exports.entity} set`, `${exports.entity} list`] }), set: projectCommand('set', 'focus the Shell on a given module', { related: [`${exports.entity} list`] }), unset: projectCommand('unset', 'remove the current module focus', { noProjectRequired: true, related: [`${exports.entity} list`, `${exports.entity} set`] }), delete: projectCommand('delete', 'delete your local copy of a given imported module', { related: [`${exports.entity} list`] }), status: syn => projectCommand(syn, "Check on the status of a module's deployment", { optional: [ { name: '--resource', alias: '-r', docs: 'Show the status of a given resource type' } ], related: [`${exports.entity} list`, `${exports.entity} watch`] }), watch: projectCommand('watch', "Monitor the status of a module's deployment", { related: [`${exports.entity} list`, `${exports.entity} status`] }) }; const mkToplevel = () => { const model = { strict: exports.entity, command: exports.entity, commandPrefix: exports.entity, title: 'Module management', header: 'Commands related to module management', example: `${exports.entity} <command>`, nRowsInViewport: 6, available: [] }; for (const cmd in exports.usage) { model.available.push(exports.usage[cmd]); } return model; }; exports.toplevel = mkToplevel(); //# sourceMappingURL=usage.js.map