diff --git a/.github/cli/grab-cli-texts.sh b/.github/cli/grab-cli-texts.sh index 0a8a5546f..bf3af23df 100755 --- a/.github/cli/grab-cli-texts.sh +++ b/.github/cli/grab-cli-texts.sh @@ -10,11 +10,14 @@ pushd `dirname ${proj}` && cds init `basename ${proj}` && pushd `basename ${proj echo echo "Grabbing CLI texts..." -${dir}/grab-cli-texts.js @sap/cds-dk "cds add --help" ${proj} > ${dir}/../../tools/assets/help/cds-add.out.md ${dir}/grab-cli-texts.js @cap-js/cds-typer "cds-typer --help" ${proj} > ${dir}/../../tools/assets/help/cds-typer.out.md ${dir}/grab-cli-texts.js @sap/cds-dk "cds --help" ${proj} > ${dir}/../../tools/assets/help/cds-help.out.md -${dir}/grab-cli-texts.js @sap/cds-dk "cds watch --help" ${proj} > ${dir}/../../tools/assets/help/cds-watch.out.md +${dir}/grab-cli-texts.js @sap/cds-dk "cds add --help" ${proj} > ${dir}/../../tools/assets/help/cds-add.out.md +${dir}/grab-cli-texts.js @sap/cds-dk "cds compile --help" ${proj} > ${dir}/../../tools/assets/help/cds-compile.out.md +${dir}/grab-cli-texts.js @sap/cds-dk "cds env --help" ${proj} > ${dir}/../../tools/assets/help/cds-env.out.md +${dir}/grab-cli-texts.js @sap/cds-dk "cds init --help" ${proj} > ${dir}/../../tools/assets/help/cds-init.out.md ${dir}/grab-cli-texts.js @sap/cds-dk "cds repl --help" ${proj} > ${dir}/../../tools/assets/help/cds-repl.out.md +${dir}/grab-cli-texts.js @sap/cds-dk "cds watch --help" ${proj} > ${dir}/../../tools/assets/help/cds-watch.out.md ${dir}/grab-cli-texts.js @sap/cds-dk "cds version" ${proj} > ${dir}/../../tools/assets/help/cds-version.out.md ${dir}/grab-cli-texts.js @sap/cds-dk "cds version --markdown" ${proj} > ${dir}/../../tools/assets/help/cds-version-md.out.md ${dir}/grab-cli-texts.js @sap/cds-dk "cds env requires.db" ${proj} > ${dir}/../../tools/assets/help/cds-env-requires-db.out.md diff --git a/get-started/in-a-nutshell.md b/get-started/in-a-nutshell.md index f0e06a1af..aed428d5d 100644 --- a/get-started/in-a-nutshell.md +++ b/get-started/in-a-nutshell.md @@ -193,7 +193,7 @@ cds db/schema.cds -2 yml cds db/schema.cds -2 sql ``` -[Learn more about the command line interface by executing `cds help`.](#cli){.learn-more} +[Learn more about the command line interface by executing `cds help`.](../tools/cds-cli#cds-help){.learn-more} diff --git a/node.js/cds-compile.md b/node.js/cds-compile.md index 5f8df6b80..fac738567 100644 --- a/node.js/cds-compile.md +++ b/node.js/cds-compile.md @@ -40,7 +40,6 @@ It supports different variants based on the type of the first argument `model` a Depending on the variants, the method returns a Promise or a sync value. - ### Compiling `.cds` files (async) If the first argument is either a string starting with `"file:"`, or an _array_ of filenames, these files are read and compiled to a single CSN asynchronously: @@ -53,6 +52,9 @@ let csn = await cds.compile ('file:db') > The given filenames are resolved to effective absolute filenames using [`cds.resolve`](#cds-resolve). +> [!TIP] Use cds compile as CLI equivalent +> The [`cds compile` CLI](../tools/cds-cli#cds-compile) is available as entry point to the functions described here. For example, `cds compile --to hana` maps to `cds.compile.to.hana` etc. + ### Single in-memory sources diff --git a/tools/assets/help/cds-compile.out.md b/tools/assets/help/cds-compile.out.md new file mode 100644 index 000000000..2479f58c0 --- /dev/null +++ b/tools/assets/help/cds-compile.out.md @@ -0,0 +1,130 @@ + +
+> cds compile --help
+
+SYNOPSIS
+  cds compile <models> [<options>]
+
+  Compiles the specified models to CSN format, applying processors to unfold
+  and generate target outputs using the <options>.
+  
+
+OPTIONS  
+
+  -2 | --to <target format>
+
+    Compiles the given models to the specified <target format>.
+    Currently supported:
+
+    - json, yml
+    - edm, edmx, edmx-v2, edmx-v4, edmx-w4, edmx-x4
+    - sql, hdbcds, hdbtable, hana
+    - cdl
+    - xsuaa
+    - openapi
+    - asyncapi
+
+  -4 | --for <target>
+
+    Unfolds the compiled CSN for the specified <target> usages,
+    or get a comma-separated list, without generating target formats.
+    Currently supported:
+
+    - odata
+    - sql
+
+  --dialect <dialect>
+
+    Needs option --to.
+    Specify the dialect in combination with --to sql.
+    Currently supported:
+
+    - sqlite
+    - h2
+    - postgres
+    - hana
+
+  -s | --service <name> | all
+
+    Chooses a specific service or all to force output for all services.
+    The service name must be fully qualified, including the namespace, if any.
+
+  -l | --lang <languages> | all
+
+    Localizes the output with given <languages>, a comma-separated list
+    of language/locale codes or all.
+    Localization is carried out before all other processors (-4/u) or backends (-2).
+
+  -o | --dest <folder>
+
+    Writes output to the given folder instead of stdout.
+
+  -f | --flavor sources | files | parsed | xtended | inferred
+
+    Depending on the argument, returns a model with the given level of detail:
+
+      sources:  paths and content of all resolved source files
+      files:    paths of all effectively referenced files
+      parsed:   the definitions and extensions, without applying the
+                extensions or includes, and without imported definitions.
+      xtended:  the definitions with all imports and extensions resolved,
+                but without any derived information
+      inferred: the effective model, including imported definitions, extensions,
+                and derived information.  This is the default flavor.
+
+  --parse
+
+    Shortcut for '--flavor parsed'
+
+  --plain
+
+    Shortcut for '--flavor xtended'
+
+  --docs
+
+    Preserves /**...*/ doc comments in 'doc' properties of CSN outputs,
+    as well as in 'Core.Description' annotations of EDMX outputs.
+
+  --locations
+
+    Preserves $location properties of CSN outputs.
+
+  --log-level debug | info | warn | error
+
+    Chooses which level of compiler messages to log. The default log-level is warn.
+
+  --openapi:url <Server URL for Open API export>
+
+    The server URL used in the generated OpenAPI document. The default is the service
+    base path as declared in the CDS source.
+    Use the ${service-path} variable to have the service path included in the URL.
+
+  --openapi:servers <Stringified JSON Object for Open API export>
+
+    The servers definition used in the generated OpenAPI document. --openapi:url is
+    ignored when this option is specified.
+
+    --odata-version 4.0|4.01
+
+    Adds the OData version's functionality of the input CDS/CSN file to the generated OpenAPI document.
+
+  --openapi:diagram
+
+    Include YUML diagram in the generated OpenAPI document, default: false.
+
+  --openapi:config-file filename
+
+    The passed configuration file will be read to generate the OpenAPI document, incorporating all specified options.
+    Precedence of Options: Inline options specified in the command line will take precedence over those defined in the configuration file.
+
+  --asyncapi:merged
+
+    A single AsyncAPI document is generated using the details of all input services. Information of title
+    and version should be provided as preset.
+
+EXAMPLES
+   cds compile model.cds
+   cds c model.json --to sql
+   cds srv -s all -l all -2 edmx -o out
+   cds compile srv -s sap.sample.TestService -2 asyncapi -o out
+
diff --git a/tools/assets/help/cds-env.out.md b/tools/assets/help/cds-env.out.md new file mode 100644 index 000000000..e3966b940 --- /dev/null +++ b/tools/assets/help/cds-env.out.md @@ -0,0 +1,46 @@ + +
+> cds env --help
+
+SYNOPSIS
+    cds env [<key>] [<options>]
+
+EXPLANATION
+    Displays the effective configuration for the given key, or all of the
+    current environment.
+
+OPTIONS
+    --sources
+
+       Lists the sources from with the current env has been compiled.
+
+    -k | --keys
+
+       Prints (top-level) keys of matching properties only
+
+    -p | --properties
+    -l | --list
+
+       Prints output in .properties format
+
+    -j | --json
+
+       Prints output in JSON format
+
+    -r | --raw
+
+       Prints output with minimum formatting or decoration
+
+    -4 | --for | --profile <profile,...>
+
+       Load configuration for the specified profile(s).
+       The development profile is used by default.
+
+    -P | --process-env
+
+       Show properties from Node.js process.env.
+
+    -b | --resolve-bindings
+
+       Resolve remote service bindings configured via cds bind.
+
diff --git a/tools/assets/help/cds-init.out.md b/tools/assets/help/cds-init.out.md new file mode 100644 index 000000000..78c29e8af --- /dev/null +++ b/tools/assets/help/cds-init.out.md @@ -0,0 +1,90 @@ + +
+> cds init --help
+
+SYNOPSIS
+    cds init [<project>] [<options>]
+
+    Initializes a new project in folder ./<project>, with the current
+    working directory as default.
+
+OPTIONS
+    --java
+
+        Create a CAP Java project.
+
+    --add <feature | comma-separated list of features>
+
+        Add one or more features while creating the project.
+        <feature> can be one of the following:
+
+      completion                   - shell completion for cds commands
+      java                         - creates a Java-based project
+      nodejs                       - creates a Node.js-based project
+      esm                          - ESM-compatible Node.js project
+      tiny-sample                  - add minimal sample files
+      sample                       - add sample files including Fiori UI
+      typer                        - type generation for CDS models
+      typescript                   - add minimum configuration for a bare TypeScript project
+      handler                      - handler stubs for service entities, actions and functions
+      mta                          - Cloud Foundry deployment using mta.yaml
+      cf-manifest                  - Cloud Foundry deployment using manifest files
+      helm                         - Kyma deployment using Helm charts
+      helm-unified-runtime         - Kyma deployment using Unified Runtime Helm charts
+      containerize                 - containerization using ctz CLI
+      multitenancy                 - schema-based multitenancy support
+      toggles                      - allow dynamically toggled features
+      extensibility                - tenant-specific model extensibility
+      side-by-side-extensibility   - logic extensibility via extension points
+      mtx                          - multitenancy + toggles + extensibility
+      xsuaa                        - authentication via XSUAA
+      ias                          - authentication via IAS
+      ams                          - authorization via AMS
+      hana                         - database support for SAP HANA
+      postgres                     - database support for PostgreSQL
+      sqlite                       - database support for SQLite
+      h2                           - database support for H2
+      liquibase                    - database migration using Liquibase
+      redis                        - SAP BTP Redis, Hyperscaler Option
+      attachments                  - SAP BTP Object Store Service
+      malware-scanner              - SAP Malware Scanning Service
+      local-messaging              - messaging via local event bus
+      file-based-messaging         - messaging via file system
+      enterprise-messaging         - messaging via SAP Enterprise Messaging
+      enterprise-messaging-shared  - messaging via shared SAP Enterprise Messaging
+      redis-messaging              - messaging via Redis
+      kafka                        - messaging via Apache Kafka
+      approuter                    - dynamic routing using @sap/approuter
+      connectivity                 - SAP BTP Connectivity Service
+      destination                  - SAP BTP Destination Service
+      html5-repo                   - SAP BTP HTML5 Application Repository
+      portal                       - SAP BTP Portal Service
+      application-logging          - SAP BTP Application Logging Service
+      audit-logging                - SAP BTP Audit Logging Service
+      notifications                - SAP BTP Notification Service
+      workzone-standard            - SAP BTP Work Zone, Standard Edition
+      data                         - add CSV headers for modeled entities
+      http                         - add .http files for modeled services
+      lint                         - configure cds lint
+      pipeline                     - CI/CD pipeline integration
+
+    --java:mvn <Comma separated maven archetype specific parameters>
+
+        Add the given parameters to the archetype call.
+        See https://cap.cloud.sap/docs/java/developing-applications/building#the-maven-archetype
+        for parameters supported by the archetype.
+
+    --force
+
+        Overwrite all files.
+
+EXAMPLES
+    cds init bookshop
+    cds init bookshop --java
+    cds init bookshop --add hana
+    cds init bookshop --add multitenancy,mta
+    cds init --java --java:mvn groupId=myGroup,artifactId=newId,package=my.company
+
+SEE ALSO
+    cds add - to augment your projects later on
+
diff --git a/tools/assets/help/cds-watch.out.md b/tools/assets/help/cds-watch.out.md index 21281a3a9..a19040e0d 100644 --- a/tools/assets/help/cds-watch.out.md +++ b/tools/assets/help/cds-watch.out.md @@ -24,6 +24,14 @@ Specify file extensions to watch for in a comma-separated list. Example: cds w --ext cds,json,js. + --include <paths,...> + + Comma-separated list of additional paths to watch. + + --exclude <paths,...> + + Comma-separated list of additional paths to ignore. + --livereload <port | false> Specify the port for the livereload server. Defaults to '35729'. diff --git a/tools/cds-cli.md b/tools/cds-cli.md index d5960aae1..b50d8678d 100644 --- a/tools/cds-cli.md +++ b/tools/cds-cli.md @@ -82,7 +82,7 @@ Use `cds help` to see an overview of all commands: Use `cds help ` or `cds ?` to get specific help: - + ## cds init @@ -102,6 +102,9 @@ For example to create a project with a sample bookshop model and configuration f cds init --add sample,hana ``` +::: details See the full help text of `cds init` + +::: ## cds add @@ -362,9 +365,22 @@ Use `cds env` to inspect currently effective config settings: +::: details See the full help text of `cds env` + +::: + ## cds compile +Compiles the specified models to [CSN](../cds/csn) or other formats. + +[See simple examples in the getting started page](../get-started/in-a-nutshell#cli).{.learn-more} + +[For the set of built-in compile 'formats', see the `cds.compile.to` API](../node.js/cds-compile#cds-compile-to).{.learn-more} + + +In addition, the following formats are available: + ### mermaid {.compile} This produces text for a [Mermaid class diagram](https://mermaid.js.org/syntax/classDiagram.html):