UNPKG

@sap/cds-dk

Version:

Command line client and development toolkit for the SAP Cloud Application Programming Model

63 lines (52 loc) 2.35 kB
const cds = require('../lib/cds') module.exports = exports = Object.assign (help, {formatHelp, handleCompletion, help:` # USAGE *cds* <command> [<args>] *cds* <src> = *cds compile* <src> *cds* = *cds help* # COMMANDS *i* | *init* jump-start cds-based projects *a* | *add* add a feature to an existing project *m* | *import* add models from external sources *c* | *compile* compile cds models to different outputs *p* | *parse* parses given cds models *s* | *serve* run your services in local server *w* | *watch* run and restart on file changes * * | *mock* call _cds serve_ with mocked service *r* | *repl* read-eval-event loop *e* | *env* inspect effective configuration *b* | *build* prepare for deployment *d* | *deploy* deploy to databases * * | *up* build and deploy your application to the cloud *y* | *bind* bind application to remote services * * | *debug* debug your application * * | *subscribe* subscribe a tenant to a multitenant SaaS app * * | *unsubscribe* unsubscribe a tenant from a multitenant SaaS app *l* | *login* login to extensible multitenant SaaS app * * | *logout* logout from extensible multitenant SaaS app * * | *pull* pull base model of extensible SaaS app * * | *push* push extension to extensible SaaS app * * | *lint* run linter for env or model checks *v* | *version* get detailed version information * * | *completion* add/remove cli completion for cds commands *h* | *help* get detailed usage information Learn more about each command using: *cds help* <command> or *cds* <command> *--help* `}); async function handleCompletion() { const cds = require('./cds'); return Object.values(cds.cmds); } async function help (topic) { await cds.plugins if (Array.isArray(topic)) topic = topic[0] const task = !topic ? help : this.load?.(this.Shortcuts[topic] || topic) if (task?.help) console.log (formatHelp (task.help)) } function formatHelp (text) { return text .replace(/\n# ([^\n]*)\n/g, `\n\x1b[1m$1\x1b[0m\n`) .replace(/ \*([^*]+)\*/g, ` \x1b[1m$1\x1b[0m`) .replace(/ _([^_]+)_/g, ` \x1b[4m$1\x1b[0m`) }