Skip to content

Commit

Permalink
List of typical commands
Browse files Browse the repository at this point in the history
  • Loading branch information
chgeo committed Sep 18, 2024
1 parent ddbf910 commit dadda47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apis/facade.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ export const version: string
export const home: string
export const root: string

type CliCommands = 'add' | 'build' | 'compile' | 'deploy' | 'import' | 'init' | 'serve' | (string & {})
/**
* The parsed effective `cds` CLI command and arguments.
* May be undefined if not started from the `cds` CLI.
* @see https://cap.cloud.sap/docs/node.js/cds-facade#cds-cli
*/
export const cli: {
/** Basic command like `serve` */ command?: string,
/** Basic command like `serve` */ command?: CliCommands,
/** Positional arguments */ argv?: string[],
/** Named arguments */ options?: Record<string, any>,
} | undefined


import { env } from './env'
export const requires: env.Requires
5 changes: 4 additions & 1 deletion test/typescript/apis/project/cds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ cds.home === 'path/to/cds'
cds.root === 'path/to/project'
cds.requires === cds.env.requires

cds.cli!.command = 'foo'
cds.cli!.argv = ['']
cds.cli!.options = { foo: true }
cds.cli!.command = 'deploy'
cds.cli!.command = 'unknown-command'
//@ts-expect-error
cds.cli!.command = true

0 comments on commit dadda47

Please sign in to comment.