@sap/cds-dk
Version:
Command line client and development toolkit for the SAP Cloud Application Programming Model
82 lines (56 loc) • 2.53 kB
JavaScript
module.exports = Object.assign(pull, {
options: ['--directory', '--subdomain', '--passcode', '--user', '--client', '--from'],
flags: [],
shortcuts: ['-d', '-s', '-p', '-u', '-c'],
help: `
# SYNOPSIS
*cds pull* [ [--from] <app url> ]
Pull the base model for your SaaS app extension.
If the app URL is omitted, it is determined from the current user's active
CDS or Cloud Foundry login.
Before running this command, prepare your extension project from a template
obtained from the SaaS application provider. It must contain a package.json
file for the project metadata, including the 'extends' field, which
specifies the base-model name.
The base model is saved in a sub-folder named '.base' (may be renamed after
the first pull). This folder is automatically included in package.json as a
workspace. Thus, any subsequent *npm install* will install the base model
into node_modules, in a sub-folder named after the base-model name. You can
thus refer to the base model in your extension by this name.
Authentication data will not be saved.
# OPTIONS
*-d* | *--directory* <project-extension-directory>
Specify the target directory of your extension project. By default, the
current working directory is used.
*-s* | *--subdomain* <tenant-subdomain>
Specify your tenant's subdomain. By default, it's determined from the
app URL.
*-p* | *--passcode* <passcode>
Tenant-specific passcode for authentication.
*-u* | *--user* <name>[:[<password>]]
Username and optionally password for authentication with Basic Auth in
test scenarios.
*-c* | *--client* <clientid>[:<clientsecret>]
Client ID and optionally Client Secret for authentication.
# SEE ALSO
*cds push* to push an extension to the SaaS app.
*cds login* for more information on authentication options.
*cds login* to save project settings and authentication data, simplifying
multiple runs of this command.
`});
async function pull([url], options = {}) {
const [username, password] = options.user?.split(':') ?? [];
delete options.user;
const [clientid, clientsecret] = options.client?.split(':') ?? [];
delete options.client;
if (options.from) url = options.from;
delete options.from;
await require('../lib/mtx/pull').run({
...options,
url,
username,
password,
clientid,
clientsecret
});
}