@sap/cds-dk 10.0.7 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/bin/add.js +7 -23
- package/bin/bind.js +10 -0
- package/bin/build.js +20 -34
- package/bin/cds.js +1 -1
- package/bin/compile/index.js +15 -41
- package/bin/completion/completionFs.js +11 -8
- package/bin/completion/index.js +592 -80
- package/bin/completion/scripts/cds.fish +568 -0
- package/bin/completion/scripts/cds.ps1 +329 -0
- package/bin/completion/scripts/cds.sh +261 -0
- package/bin/completion/scripts/cds.zsh +230 -0
- package/bin/completion/templates/cds-tmpl.fish +65 -0
- package/bin/completion/templates/cds-tmpl.ps1 +208 -0
- package/bin/completion/templates/cds-tmpl.sh +93 -0
- package/bin/completion/templates/cds-tmpl.zsh +74 -0
- package/bin/deploy/index.js +7 -1
- package/bin/deploy/options.js +25 -0
- package/{lib → bin}/deploy/to-hana/hana.js +8 -8
- package/{lib → bin}/deploy/to-hana/hdiDeployUtil.js +1 -1
- package/bin/deploy/{to-hana.js → to-hana/index.js} +1 -1
- package/{lib → bin}/deploy/to-hana/mtaUtil.js +1 -1
- package/bin/deploy/to-sql.js +0 -2
- package/bin/export.js +35 -5
- package/bin/help/export.md +3 -0
- package/bin/help.js +1 -5
- package/bin/import.js +6 -0
- package/bin/init.js +5 -24
- package/bin/inspect.js +6 -0
- package/bin/login.js +26 -20
- package/bin/pull.js +19 -6
- package/bin/push.js +19 -6
- package/bin/up.js +14 -11
- package/{lib → bin}/upgrade/constants.js +1 -1
- package/bin/{upgrade.js → upgrade/index.js} +2 -2
- package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
- package/{lib → bin}/upgrade/preflight/index.js +1 -1
- package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
- package/{lib → bin}/upgrade/steps/install.js +1 -1
- package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/removals.js +1 -1
- package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
- package/{lib → bin}/upgrade/steps/verify.js +1 -1
- package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
- package/{lib → bin}/upgrade/util/pom.js +2 -2
- package/{lib → bin}/upgrade/util/prompt.js +1 -1
- package/bin/util/containerize.js +8 -4
- package/bin/version.js +10 -1
- package/{lib → bin}/watch/hot-reload.js +1 -1
- package/bin/{watch.js → watch/index.js} +17 -9
- package/{lib → bin}/watch/livereload-connect.js +1 -1
- package/{lib → bin}/watch/vite-watch.js +1 -1
- package/{lib → bin}/watch/watched.js +2 -2
- package/lib/build/constants.js +1 -1
- package/lib/build/plugins/fiori/index.js +31 -2
- package/lib/build/plugins/internal.js +4 -2
- package/lib/build/plugins/mtx-sidecar/index.js +7 -8
- package/lib/build/plugins/nodejs/index.js +64 -7
- package/lib/compile/to_asyncapi.js +1 -1
- package/lib/env/schema.js +16 -0
- package/lib/env/schemas/cds-rc.js +1 -76
- package/lib/import/importapi.js +2 -3
- package/lib/import/message.js +0 -2
- package/lib/init/constants.js +2 -1
- package/lib/init/index.js +2 -2
- package/lib/init/merge.js +123 -280
- package/lib/init/plugin.js +3 -1
- package/lib/init/projectReader.js +22 -6
- package/lib/init/registries/xs-app.js +3 -5
- package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
- package/lib/init/template/ai/index.js +14 -2
- package/lib/init/template/ams/index.js +2 -2
- package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/app-frontend/index.js +4 -4
- package/lib/init/template/application-logging/index.js +2 -2
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/index.js +8 -3
- package/lib/init/template/attachments/files/package.json.hbs +1 -1
- package/lib/init/template/attachments/index.js +2 -2
- package/lib/init/template/audit-logging/index.js +2 -2
- package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
- package/lib/init/template/cloud-logging/index.js +2 -2
- package/lib/init/template/completion/completionSetup.js +36 -39
- package/lib/init/template/connectivity/index.js +2 -2
- package/lib/init/template/data/as-csv.js +15 -5
- package/lib/init/template/data/as-json.js +114 -42
- package/lib/init/template/data/index.js +16 -2
- package/lib/init/template/destination/index.js +2 -2
- package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
- package/lib/init/template/dynatrace/index.js +2 -2
- package/lib/init/template/enterprise-messaging/index.js +2 -2
- package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
- package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
- package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
- package/lib/init/template/extensibility/index.js +3 -3
- package/lib/init/template/github-actions/index.js +2 -2
- package/lib/init/template/hana/index.js +3 -2
- package/lib/init/template/hana-serverless/files/db/package.json +14 -0
- package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
- package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
- package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
- package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
- package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
- package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
- package/lib/init/template/hana-serverless/index.js +184 -0
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
- package/lib/init/template/html5-repo/index.js +18 -14
- package/lib/init/template/http/index.js +123 -26
- package/lib/init/template/ias/index.js +2 -2
- package/lib/init/template/kafka/index.js +2 -2
- package/lib/init/template/kyma/index.js +7 -5
- package/lib/init/template/malware-scanner/index.js +2 -2
- package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +18 -3
- package/lib/init/template/notifications/index.js +2 -2
- package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
- package/lib/init/template/portal/index.js +13 -8
- package/lib/init/template/postgres/index.js +2 -2
- package/lib/init/template/redis/index.js +2 -2
- package/lib/init/template/sample/files/db/currencies.cds +2 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
- package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
- package/lib/init/template/workzone-standard/index.js +5 -5
- package/lib/init/template/xsuaa/index.js +20 -2
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/mtx/auth_manager.js +103 -37
- package/lib/mtx/params.js +3 -2
- package/lib/mtx/settings_manager.js +45 -28
- package/lib/mtx/tenant_action.js +0 -1
- package/lib/mtx/util/credentials.js +62 -0
- package/node_modules/@sap/cds/CHANGELOG.md +57 -0
- package/node_modules/@sap/cds/app/index.js +5 -4
- package/node_modules/@sap/cds/eslint.config.mjs +1 -0
- package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
- package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
- package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
- package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
- package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
- package/node_modules/@sap/cds/lib/plugins.js +9 -5
- package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
- package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
- package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
- package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
- package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
- package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
- package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
- package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
- package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
- package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
- package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
- package/node_modules/@sap/cds/libx/http/location.js +3 -3
- package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
- package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
- package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
- package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
- package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
- package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
- package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
- package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
- package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
- package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
- package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
- package/node_modules/@sap/cds/package.json +1 -1
- package/node_modules/@sap/cds-compiler/CHANGELOG.md +60 -8
- package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
- package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
- package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
- package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
- package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
- package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
- package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
- package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
- package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
- package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
- package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
- package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +41 -15
- package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
- package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
- package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
- package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
- package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
- package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
- package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
- package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
- package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
- package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
- package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +2 -0
- package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
- package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
- package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
- package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
- package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
- package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
- package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +3 -0
- package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -2
- package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
- package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
- package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
- package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
- package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +15 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +34 -16
- package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +22 -13
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +17 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +1 -1
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +4 -8
- package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
- package/node_modules/@sap/xsenv/package.json +10 -7
- package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/hdb/cfg/VERSION +1 -1
- package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
- package/node_modules/hdb/lib/protocol/Connection.js +1 -0
- package/node_modules/hdb/package.json +3 -2
- package/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
- package/node_modules/negotiator/package.json +16 -10
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/node_modules/qs/test/parse.js +192 -3
- package/node_modules/qs/test/stringify.js +317 -0
- package/node_modules/qs/test/utils.js +12 -0
- package/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/package.json +3 -3
- package/bin/completion/scripts/cds-bash.sh +0 -20
- package/bin/completion/scripts/cds-fish.fish +0 -13
- package/bin/completion/scripts/cds-ps.ps1 +0 -19
- package/bin/completion/scripts/cds-zsh.sh +0 -13
- package/lib/deploy/index.js +0 -25
- package/lib/import/asyncapi/importAsyncAPI.js +0 -33
- package/lib/import/asyncapi/index.js +0 -18
- package/lib/import/asyncapi/parserContext.js +0 -454
- package/lib/import/asyncapi/utils.js +0 -49
- package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
- package/node_modules/negotiator/HISTORY.md +0 -114
- /package/{lib → bin}/upgrade/context.js +0 -0
- /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
- /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
- /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
- /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
- /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
- /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
- /package/{lib → bin}/watch/livereload-server.js +0 -0
- /package/{lib → bin}/watch/node-watch.js +0 -0
- /package/{lib → bin}/watch/open.js +0 -0
- /package/{lib → bin}/watch/watcher.js +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# This file was generated from bin/completion/templates/cds-tmpl.ps1 by
|
|
2
|
+
# 'cds completion --generate' and is written to bin/completion/scripts/cds.ps1.
|
|
3
|
+
#
|
|
4
|
+
# Do not edit directly — modify the template and regenerate.
|
|
5
|
+
#
|
|
6
|
+
# All static completion data is stored in a single hashtable ($_CDS_COMPLETIONS)
|
|
7
|
+
# for O(1) lookup. The ScriptBlock registered with Register-ArgumentCompleter
|
|
8
|
+
# follows the same fastest-first strategy as the bash/zsh templates:
|
|
9
|
+
# 1. Top-level commands — when cursor is on the subcommand token.
|
|
10
|
+
# 2. Shortcut resolution — single-char alias → canonical command name.
|
|
11
|
+
# 3. Flags — when $wordToComplete starts with '-'.
|
|
12
|
+
# 3.5. Option values — static values for known flags (e.g. --to sqlite).
|
|
13
|
+
# 3.6. Comma values — comma-separable list (e.g. cds add ai,hana).
|
|
14
|
+
# 4. Positionals — static known values per subcommand.
|
|
15
|
+
# 4.5. File sentinel — files only (flags shown only when $wordToComplete starts with '-').
|
|
16
|
+
# 5. Dynamic fallback — calls 'cds completion' for everything else.
|
|
17
|
+
|
|
18
|
+
$_CDS_COMMAND = "cds"
|
|
19
|
+
|
|
20
|
+
# Completion data map:
|
|
21
|
+
# __commands — array of all top-level subcommand names
|
|
22
|
+
# __shortcuts — hashtable of shortcut → canonical command name
|
|
23
|
+
# __positionals — hashtable of command → array of known positional string values
|
|
24
|
+
# __optionValues — hashtable of command → hashtable of flag → array of values,
|
|
25
|
+
# or one of the file sentinels ':file', ':dir', ':file:ext1,ext2'
|
|
26
|
+
# __commaCases — hashtable of command → hashtable of flag → array of comma-separable values
|
|
27
|
+
# <cmd> — array of flags/options for that subcommand (used by step 3)
|
|
28
|
+
$_CDS_COMPLETIONS = @{
|
|
29
|
+
'__commands' = @('add', 'bind', 'build', 'compile', 'completion', 'debug', 'deploy', 'env', 'eval', 'export', 'gen', 'help', 'import', 'init', 'inspect', 'lint', 'login', 'logout', 'minify', 'mock', 'parse', 'pull', 'push', 'repl', 'run', 'serve', 'subscribe', 'test', 'unsubscribe', 'up', 'upgrade', 'upgrade-tenant', 'version', 'watch');
|
|
30
|
+
'__shortcuts' = @{
|
|
31
|
+
'i' = 'init';
|
|
32
|
+
'a' = 'add';
|
|
33
|
+
'y' = 'bind';
|
|
34
|
+
'm' = 'import';
|
|
35
|
+
'c' = 'compile';
|
|
36
|
+
'p' = 'parse';
|
|
37
|
+
's' = 'serve';
|
|
38
|
+
'w' = 'watch';
|
|
39
|
+
'e' = 'env';
|
|
40
|
+
'b' = 'build';
|
|
41
|
+
'd' = 'deploy';
|
|
42
|
+
'l' = 'login';
|
|
43
|
+
'o' = 'logout';
|
|
44
|
+
't' = 'test';
|
|
45
|
+
'v' = 'version';
|
|
46
|
+
'h' = 'help';
|
|
47
|
+
'r' = 'repl'
|
|
48
|
+
};
|
|
49
|
+
'__positionals' = @{
|
|
50
|
+
'help' = @('add', 'bind', 'build', 'compile', 'completion', 'debug', 'deploy', 'env', 'eval', 'export', 'gen', 'help', 'import', 'init', 'inspect', 'lint', 'login', 'logout', 'minify', 'mock', 'parse', 'pull', 'push', 'repl', 'run', 'serve', 'subscribe', 'test', 'unsubscribe', 'up', 'upgrade', 'upgrade-tenant', 'version', 'watch')
|
|
51
|
+
};
|
|
52
|
+
'__optionValues' = @{
|
|
53
|
+
'bind' = @{
|
|
54
|
+
'--on' = @('cf', 'k8s');
|
|
55
|
+
'--out' = ':file';
|
|
56
|
+
'--output-file' = ':file'
|
|
57
|
+
};
|
|
58
|
+
'build' = @{
|
|
59
|
+
'--for' = @('hana', 'helm', 'java', 'mtx', 'mtx-extension', 'mtx-sidecar', 'nodejs');
|
|
60
|
+
'--log-level' = @('debug', 'error', 'info', 'warn');
|
|
61
|
+
'--dest' = ':dir';
|
|
62
|
+
'--src' = ':dir'
|
|
63
|
+
};
|
|
64
|
+
'compile' = @{
|
|
65
|
+
'--to' = @('asyncapi', 'cdl', 'edm', 'edmx', 'edmx-v2', 'edmx-v4', 'hana', 'hdbtable', 'json', 'openapi', 'sql', 'xsuaa', 'yml');
|
|
66
|
+
'--for' = @('odata', 'sql');
|
|
67
|
+
'--dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
68
|
+
'--sql-dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
69
|
+
'--log-level' = @('debug', 'error', 'info', 'warn');
|
|
70
|
+
'--odata-version' = @('4.0', '4.01');
|
|
71
|
+
'--flavor' = @('files', 'inferred', 'parsed', 'sources', 'xtended');
|
|
72
|
+
'--service' = @('all');
|
|
73
|
+
'--lang' = @('all');
|
|
74
|
+
'--dest' = ':dir';
|
|
75
|
+
'_' = ':file:cds,json'
|
|
76
|
+
};
|
|
77
|
+
'completion' = @{
|
|
78
|
+
'--shell' = @('bash', 'fish', 'gitbash', 'ps', 'zsh')
|
|
79
|
+
};
|
|
80
|
+
'deploy' = @{
|
|
81
|
+
'--to' = @('hana', 'sqlite');
|
|
82
|
+
'--on' = @('cf', 'k8s');
|
|
83
|
+
'_' = ':file:cds,json'
|
|
84
|
+
};
|
|
85
|
+
'import' = @{
|
|
86
|
+
'--from' = @('asyncapi', 'edmx', 'openapi');
|
|
87
|
+
'--as' = @('cds', 'csn', 'json');
|
|
88
|
+
'_' = ':file:json,xml,edmx'
|
|
89
|
+
};
|
|
90
|
+
'init' = @{
|
|
91
|
+
'--java:package' = ':dir'
|
|
92
|
+
};
|
|
93
|
+
'inspect' = @{
|
|
94
|
+
'--kind' = @('aspect', 'entity', 'service', 'type');
|
|
95
|
+
'_' = ':file:cds,json'
|
|
96
|
+
};
|
|
97
|
+
'parse' = @{
|
|
98
|
+
'--to' = @('asyncapi', 'cdl', 'edm', 'edmx', 'edmx-v2', 'edmx-v4', 'hana', 'hdbtable', 'json', 'openapi', 'sql', 'xsuaa', 'yml');
|
|
99
|
+
'--for' = @('odata', 'sql');
|
|
100
|
+
'--dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
101
|
+
'--sql-dialect' = @('h2', 'hana', 'postgres', 'sqlite');
|
|
102
|
+
'--log-level' = @('debug', 'error', 'info', 'warn');
|
|
103
|
+
'--odata-version' = @('4.0', '4.01');
|
|
104
|
+
'--flavor' = @('files', 'inferred', 'parsed', 'sources', 'xtended');
|
|
105
|
+
'--service' = @('all');
|
|
106
|
+
'--lang' = @('all');
|
|
107
|
+
'--dest' = ':dir';
|
|
108
|
+
'_' = ':file:cds,json'
|
|
109
|
+
};
|
|
110
|
+
'up' = @{
|
|
111
|
+
'--to' = @('cf', 'k8s')
|
|
112
|
+
};
|
|
113
|
+
'version' = @{
|
|
114
|
+
'--omit' = @('dev', 'optional', 'peer')
|
|
115
|
+
};
|
|
116
|
+
'watch' = @{
|
|
117
|
+
'--experimental-hot-reload' = @('false', 'true');
|
|
118
|
+
'--livereload' = @('false');
|
|
119
|
+
'--include' = ':dir';
|
|
120
|
+
'--exclude' = ':dir'
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
'__commaCases' = @{
|
|
124
|
+
'add' = @{
|
|
125
|
+
'_' = @('ai', 'ams', 'app-frontend', 'application-logging', 'approuter', 'attachments', 'audit-logging', 'cf-manifest', 'cjs', 'cloud-logging', 'completion', 'connectivity', 'console', 'data', 'destination', 'dynatrace', 'enterprise-messaging', 'enterprise-messaging-shared', 'event-mesh', 'event-mesh-shared', 'extensibility', 'extension', 'file-based-messaging', 'github-actions', 'h2', 'hana', 'hana-serverless', 'handler', 'html5-repo', 'http', 'ias', 'initial', 'kafka', 'kyma', 'lint', 'liquibase', 'local-messaging', 'malware-scanner', 'mta', 'mtx', 'multitenancy', 'notifications', 'pipeline', 'portal', 'postgres', 'react', 'redis', 'redis-messaging', 'sample', 'side-by-side-extensibility', 'sqlite', 'telemetry', 'test', 'tiny-sample', 'toggles', 'typer', 'typescript', 'ui5', 'vue', 'workzone', 'workzone-standard', 'xsuaa')
|
|
126
|
+
};
|
|
127
|
+
'init' = @{
|
|
128
|
+
'--add' = @('ai', 'ams', 'app-frontend', 'application-logging', 'approuter', 'attachments', 'audit-logging', 'cf-manifest', 'cjs', 'cloud-logging', 'completion', 'connectivity', 'console', 'data', 'destination', 'dynatrace', 'enterprise-messaging', 'enterprise-messaging-shared', 'event-mesh', 'event-mesh-shared', 'extensibility', 'extension', 'file-based-messaging', 'github-actions', 'h2', 'hana', 'hana-serverless', 'handler', 'html5-repo', 'http', 'ias', 'initial', 'kafka', 'kyma', 'lint', 'liquibase', 'local-messaging', 'malware-scanner', 'mta', 'mtx', 'multitenancy', 'notifications', 'pipeline', 'portal', 'postgres', 'react', 'redis', 'redis-messaging', 'sample', 'side-by-side-extensibility', 'sqlite', 'telemetry', 'test', 'tiny-sample', 'toggles', 'typer', 'typescript', 'ui5', 'vue', 'workzone', 'workzone-standard', 'xsuaa')
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
'add' = @('--base', '--cdm', '--cloudevents', '--content-type', '--data:for', '--dry', '--filter', '--for', '--for-app', '--force', '--into', '--java:mvn', '--keys-only', '--out', '--package', '--plan', '--records', '--sap', '--shell', '--unified-runtime', '--with-telemetry', '--y');
|
|
132
|
+
'bind' = @('--credentials', '--exec', '--for', '--kind', '--no-create-service-key', '--on', '--out', '--output-file', '--to', '--to-app-services');
|
|
133
|
+
'build' = @('--dest', '--for', '--log-level', '--no-clean', '--no-ws-pack', '--options-model', '--opts', '--project', '--src', '--ws', '--ws-pack');
|
|
134
|
+
'compile' = @('--all', '--asyncapi:merged', '--beta', '--clean', '--conceptual', '--dest', '--dialect', '--docs', '--files', '--flavor', '--for', '--from', '--lang', '--locations', '--log-level', '--min', '--odata-version', '--openapi:config-file', '--openapi:diagram', '--openapi:servers', '--openapi:url', '--parse', '--plain', '--resolved', '--service', '--sort', '--sources', '--sql-dialect', '--to');
|
|
135
|
+
'completion' = @('--add', '--curr', '--generate', '--line', '--prev', '--profile', '--remove', '--shell');
|
|
136
|
+
'debug' = @('--cf', '--force', '--host', '--k8s', '--no-devtools', '--port');
|
|
137
|
+
'deploy' = @('--auto-undeploy', '--delta-from', '--dry', '--for', '--model-only', '--no-build', '--no-save', '--on', '--out', '--resolve-bindings', '--script', '--store-credentials', '--to', '--tunnel-address', '--vcap-file', '--with-auto-schema-evolution', '--with-mocks', '--xdry');
|
|
138
|
+
'env' = @('--for', '--json', '--keys', '--list', '--mocked', '--process-env', '--properties', '--raw', '--resolve-bindings', '--sources');
|
|
139
|
+
'eval' = @();
|
|
140
|
+
'export' = @('--artifact', '--as', '--cleanse', '--data', '--debug', '--dry', '--for', '--from', '--inspect', '--keep', '--mvn', '--plugin', '--reuse', '--services', '--skip', '--texts', '--to');
|
|
141
|
+
'help' = @();
|
|
142
|
+
'import' = @('--as', '--asyncapi', '--config', '--data-product', '--dependencies', '--destination', '--dry', '--edmx', '--for', '--force', '--from', '--group', '--include-namespaces', '--into-namespace', '--keep-namespace', '--name', '--no-copy', '--no-save', '--odata', '--odata-v2-annotations', '--openapi', '--out', '--resolve-bindings', '--rfc', '--services');
|
|
143
|
+
'init' = @('--add', '--base', '--force', '--java', '--java:mvn', '--java:package', '--lint:custom', '--lint:custom:example', '--no-db', '--nodejs', '--verbose');
|
|
144
|
+
'inspect' = @('--kind', '--list', '--stats');
|
|
145
|
+
'lint' = @('--cache', '--cache-file', '--cache-location', '--cache-strategy', '--color', '--concurrency', '--config', '--debug', '--env-info', '--exit-on-fatal-error', '--ext', '--fix', '--fix-dry-run', '--fix-type', '--flag', '--format', '--global', '--help', '--ignore-pattern', '--init', '--inspect-config', '--max-warnings', '--mcp', '--no-color', '--no-config-lookup', '--no-error-on-unmatched-pattern', '--no-ignore', '--no-inline-config', '--no-warn-ignored', '--output-file', '--parser', '--parser-options', '--pass-on-no-patterns', '--pass-on-unpruned-suppressions', '--plugin', '--print-config', '--prune-suppressions', '--quiet', '--report-unused-disable-directives', '--report-unused-disable-directives-severity', '--report-unused-inline-configs', '--rule', '--stats', '--stdin', '--stdin-filename', '--suppress-all', '--suppress-rule', '--suppressions-location', '--version');
|
|
146
|
+
'login' = @('--client', '--mtls', '--passcode', '--plain', '--save-refresh-token', '--subdomain', '--user');
|
|
147
|
+
'logout' = @('--clear-invalid', '--delete-settings', '--subdomain', '--url');
|
|
148
|
+
'minify' = @('--cleanse', '--debug', '--dry', '--inspect', '--keep', '--skip');
|
|
149
|
+
'mock' = @('--at', '--from', '--in-memory', '--in-memory?', '--mocked', '--port', '--project', '--projects', '--resolve-bindings', '--service', '--to', '--watch', '--with', '--with-bindings', '--with-mocks', '--with-mtx', '--workers');
|
|
150
|
+
'parse' = @('--all', '--asyncapi:merged', '--beta', '--clean', '--conceptual', '--dest', '--dialect', '--docs', '--files', '--flavor', '--for', '--from', '--lang', '--locations', '--log-level', '--min', '--odata-version', '--openapi:config-file', '--openapi:diagram', '--openapi:servers', '--openapi:url', '--parse', '--plain', '--resolved', '--service', '--sort', '--sources', '--sql-dialect', '--to');
|
|
151
|
+
'pull' = @('--client', '--from', '--mtls', '--passcode', '--subdomain', '--user');
|
|
152
|
+
'push' = @('--async', '--client', '--mtls', '--passcode', '--subdomain', '--sync', '--to', '--user');
|
|
153
|
+
'repl' = @('--ql', '--run', '--use');
|
|
154
|
+
'run' = @('--at', '--from', '--in-memory', '--in-memory?', '--mocked', '--port', '--project', '--projects', '--resolve-bindings', '--service', '--to', '--watch', '--with', '--with-bindings', '--with-mocks', '--with-mtx', '--workers');
|
|
155
|
+
'serve' = @('--at', '--from', '--in-memory', '--in-memory?', '--mocked', '--port', '--project', '--projects', '--resolve-bindings', '--service', '--to', '--watch', '--with', '--with-bindings', '--with-mocks', '--with-mtx', '--workers');
|
|
156
|
+
'subscribe' = @('--body', '--local', '--resolve-bindings', '--to', '--user');
|
|
157
|
+
'test' = @('--exclude', '--failed', '--files', '--include', '--list', '--passed', '--quiet', '--recent', '--silent', '--timeout', '--unmute', '--verbose', '--workers');
|
|
158
|
+
'unsubscribe' = @('--from', '--local', '--resolve-bindings', '--user');
|
|
159
|
+
'up' = @('--namespace', '--overlay', '--to');
|
|
160
|
+
'upgrade' = @('--at', '--fix', '--local', '--report', '--resolve-bindings', '--user');
|
|
161
|
+
'upgrade-tenant' = @('--at', '--local', '--resolve-bindings', '--user');
|
|
162
|
+
'version' = @('--abs', '--all', '--depth', '--info', '--json', '--markdown', '--omit');
|
|
163
|
+
'watch' = @('--debug', '--exclude', '--experimental-hot-reload', '--ext', '--in-memory', '--in-memory?', '--include', '--inspect', '--inspect-brk', '--livereload', '--open', '--port', '--with-mocks', '--with-mtx')
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
# $wordToComplete : the token currently being typed (may be empty if cursor is after a space)
|
|
167
|
+
# $commandAst : the full parsed command AST; .CommandElements is the token array
|
|
168
|
+
# $cursorPosition : byte offset of the cursor in the command string
|
|
169
|
+
Register-ArgumentCompleter -Native -CommandName $_CDS_COMMAND -ScriptBlock {
|
|
170
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
171
|
+
|
|
172
|
+
$map = $_CDS_COMPLETIONS
|
|
173
|
+
$cmdSegments = $commandAst.CommandElements
|
|
174
|
+
if ($null -eq $wordToComplete) { $wordToComplete = '' }
|
|
175
|
+
|
|
176
|
+
# Helper: emit file/dir completions for a sentinel value.
|
|
177
|
+
# Sentinel formats: ':file' (any file), ':dir' (directories only),
|
|
178
|
+
# ':file:ext1,ext2' (files with specific extensions).
|
|
179
|
+
# Uses relative paths (preserving any typed prefix) so the completed text stays short.
|
|
180
|
+
function _CdsFileComplete($sentinel, $word) {
|
|
181
|
+
$base = if ($word) { $word } else { '' }
|
|
182
|
+
$search = if ($word) { "$word*" } else { '*' }
|
|
183
|
+
# Parse extension list from ':file:cds,json' → @('.cds', '.json')
|
|
184
|
+
$exts = if ($sentinel -like ':file:*') {
|
|
185
|
+
($sentinel -replace '^:file:', '').Split(',') | ForEach-Object { ".$_" }
|
|
186
|
+
} else { $null }
|
|
187
|
+
if ($sentinel -eq ':dir') {
|
|
188
|
+
Get-ChildItem -Path $search -Directory -ErrorAction SilentlyContinue |
|
|
189
|
+
ForEach-Object {
|
|
190
|
+
$rel = $base + $_.Name
|
|
191
|
+
[System.Management.Automation.CompletionResult]::new($rel, $_.Name, 'ProviderItem', $_.Name)
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
Get-ChildItem -Path $search -File -ErrorAction SilentlyContinue |
|
|
195
|
+
Where-Object { $null -eq $exts -or $exts -contains $_.Extension } |
|
|
196
|
+
ForEach-Object {
|
|
197
|
+
$rel = $base + $_.Name
|
|
198
|
+
[System.Management.Automation.CompletionResult]::new($rel, $_.Name, 'ProviderItem', $_.Name)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
# Step 1: top-level command completion — cursor is on the subcommand token itself.
|
|
204
|
+
# Either no subcommand yet (count=1) or the user is still typing it (count=2, partial match).
|
|
205
|
+
$isTopLevel = $cmdSegments.Count -eq 1 -or ($cmdSegments.Count -eq 2 -and $wordToComplete -ne '' -and $cmdSegments[1].Extent.Text -eq $wordToComplete)
|
|
206
|
+
if ($isTopLevel) {
|
|
207
|
+
foreach ($cmd in $map['__commands']) {
|
|
208
|
+
if ($cmd.StartsWith($wordToComplete)) {
|
|
209
|
+
[System.Management.Automation.CompletionResult]::new($cmd, $cmd, 'ParameterValue', $cmd)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
# Step 2: resolve shortcut to canonical command name so the rest of the
|
|
216
|
+
# logic only needs to handle canonical names.
|
|
217
|
+
$subCmd = $cmdSegments[1].Extent.Text
|
|
218
|
+
$resolved = $map['__shortcuts'][$subCmd]
|
|
219
|
+
if ($null -ne $resolved) { $subCmd = $resolved }
|
|
220
|
+
|
|
221
|
+
# Compute $previousWord — the token immediately before the cursor.
|
|
222
|
+
# When $wordToComplete is empty the cursor is after a space, so the last completed
|
|
223
|
+
# token is the previous word. When non-empty the cursor is mid-token, so look one
|
|
224
|
+
# further back. EndOffset filtering keeps only tokens that end before the cursor.
|
|
225
|
+
$prevCandidates = $cmdSegments | Where-Object { $_.Extent.EndOffset -le $cursorPosition }
|
|
226
|
+
$previousWord = if ($wordToComplete -eq '') {
|
|
227
|
+
($prevCandidates | Select-Object -Last 1).Extent.Text
|
|
228
|
+
} else {
|
|
229
|
+
($prevCandidates | Select-Object -Last 2 | Select-Object -First 1).Extent.Text
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
# Step 3: flag/option completion — triggered when $wordToComplete starts with '-'.
|
|
233
|
+
if ($wordToComplete.StartsWith('-')) {
|
|
234
|
+
$entry = $map[$subCmd]
|
|
235
|
+
if ($null -ne $entry) {
|
|
236
|
+
foreach ($opt in $entry) {
|
|
237
|
+
if ($opt.StartsWith($wordToComplete)) {
|
|
238
|
+
[System.Management.Automation.CompletionResult]::new($opt, $opt, 'ParameterValue', $opt)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
# Step 3.5: option-value completion — triggered when the previous word is a known option.
|
|
246
|
+
$optVals = $map['__optionValues'][$subCmd]
|
|
247
|
+
if ($null -ne $optVals) {
|
|
248
|
+
$entry = $optVals[$previousWord]
|
|
249
|
+
if ($null -ne $entry) {
|
|
250
|
+
if ($entry -eq ':dir' -or $entry -eq ':file' -or $entry -like ':file:*') {
|
|
251
|
+
_CdsFileComplete $entry $wordToComplete
|
|
252
|
+
} else {
|
|
253
|
+
foreach ($val in $entry) {
|
|
254
|
+
if ($val.StartsWith($wordToComplete)) {
|
|
255
|
+
[System.Management.Automation.CompletionResult]::new($val, $val, 'ParameterValue', $val)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
# Step 3.6: comma-separated option-value completion.
|
|
264
|
+
$commaVals = $map['__commaCases'][$subCmd]
|
|
265
|
+
if ($null -ne $commaVals) {
|
|
266
|
+
# Primary lookup: previous word is the option flag (e.g. '--add').
|
|
267
|
+
$entry = $commaVals[$previousWord]
|
|
268
|
+
if ($null -eq $entry -and $previousWord.EndsWith(',')) {
|
|
269
|
+
# Space-separated continuation: user typed "cds add ai, <tab>" so $previousWord="ai,"
|
|
270
|
+
# and $wordToComplete is empty. Scan backwards through segments to find the flag.
|
|
271
|
+
$prevSegs = @($cmdSegments | ForEach-Object { $_.Extent.Text })
|
|
272
|
+
$prevIdx = [array]::LastIndexOf($prevSegs, $previousWord) - 1
|
|
273
|
+
while ($prevIdx -ge 0 -and -not $prevSegs[$prevIdx].StartsWith('-')) { $prevIdx-- }
|
|
274
|
+
if ($prevIdx -ge 0) { $entry = $commaVals[$prevSegs[$prevIdx]] }
|
|
275
|
+
}
|
|
276
|
+
# Positional fallback: previous word is not a flag (it's the subcommand or a value).
|
|
277
|
+
if ($null -eq $entry -and -not $previousWord.StartsWith('-')) {
|
|
278
|
+
$entry = $commaVals['_']
|
|
279
|
+
}
|
|
280
|
+
if ($null -ne $entry) {
|
|
281
|
+
# For space-separated comma continuation, fold previousWord into the prefix/alreadyUsed.
|
|
282
|
+
$spaceComma = $previousWord.EndsWith(',')
|
|
283
|
+
$commaWord = if ($spaceComma) { $previousWord + $wordToComplete } else { $wordToComplete }
|
|
284
|
+
$parts = $commaWord.Split(',')
|
|
285
|
+
$prefix = if ($parts.Count -gt 1) { ($parts[0..($parts.Count-2)] -join ',') + ',' } else { '' }
|
|
286
|
+
$partial = $parts[-1]
|
|
287
|
+
$alreadyUsed = @{}
|
|
288
|
+
foreach ($u in $parts[0..($parts.Count-2)]) { if ($u) { $alreadyUsed[$u] = $true } }
|
|
289
|
+
foreach ($val in $entry) {
|
|
290
|
+
if (-not $alreadyUsed.ContainsKey($val) -and $val.StartsWith($partial)) {
|
|
291
|
+
# When space-separated (prev="ai,"), PS replaces only $wordToComplete (=''),
|
|
292
|
+
# so return just $val — the prefix is already on the line.
|
|
293
|
+
$full = if ($spaceComma) { $val } else { $prefix + $val }
|
|
294
|
+
[System.Management.Automation.CompletionResult]::new($full, $val, 'ParameterValue', $val)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
# Step 4: static string positionals (e.g. cds help <tab>).
|
|
302
|
+
$positionals = $map['__positionals'][$subCmd]
|
|
303
|
+
if ($null -ne $positionals) {
|
|
304
|
+
$matched = $false
|
|
305
|
+
foreach ($pos in $positionals) {
|
|
306
|
+
if ($pos.StartsWith($wordToComplete)) {
|
|
307
|
+
[System.Management.Automation.CompletionResult]::new($pos, $pos, 'ParameterValue', $pos)
|
|
308
|
+
$matched = $true
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if ($matched) { return }
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
# Step 4.5: default file sentinel — files only, no flags appended.
|
|
315
|
+
$defaultFile = $map['__optionValues'][$subCmd]?['_']
|
|
316
|
+
if ($null -ne $defaultFile) {
|
|
317
|
+
_CdsFileComplete $defaultFile $wordToComplete
|
|
318
|
+
return
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
# Step 5: dynamic fallback — calls 'cds completion' for subcommands whose arguments
|
|
322
|
+
# cannot be determined statically (e.g. service names, model names, unknown flags).
|
|
323
|
+
# Single-quoting $previousWord/$wordToComplete prevents bare word 'h' from being
|
|
324
|
+
# interpreted as the 'help' shortcut by the completion handler.
|
|
325
|
+
$options = & $_CDS_COMMAND completion --shell ps --prev "'$previousWord'" --curr "'$wordToComplete'" --line "'$commandAst'"
|
|
326
|
+
foreach ($option in $options) {
|
|
327
|
+
[System.Management.Automation.CompletionResult]::new($option, $option, 'ParameterValue', $option)
|
|
328
|
+
}
|
|
329
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# This file was generated from bin/completion/templates/cds-tmpl.sh by
|
|
3
|
+
# 'cds completion --generate' and is written to bin/completion/scripts/cds.sh.
|
|
4
|
+
#
|
|
5
|
+
# Do not edit directly — modify the template and regenerate.
|
|
6
|
+
#
|
|
7
|
+
# Completion strategy (fastest-first):
|
|
8
|
+
# 1. Shortcuts — single-character aliases resolved before any other logic.
|
|
9
|
+
# 2. Top-level — all known subcommands when no subcommand has been typed yet.
|
|
10
|
+
# 3. Flags — matched when the current token starts with '-'.
|
|
11
|
+
# 3.5. Option values — static values for known flags (e.g. --to sqlite).
|
|
12
|
+
# 3.6. Comma values — comma-separable list (e.g. cds add ai,hana).
|
|
13
|
+
# 4. File positionals — files/dirs for subcommands that take a path argument.
|
|
14
|
+
# 4.6. String positionals — fixed word list (e.g. cds help <tab>).
|
|
15
|
+
# 5. Dynamic fallback — calls 'cds completion' for anything not covered above.
|
|
16
|
+
#
|
|
17
|
+
# compopt -o nospace suppresses the trailing space bash normally appends after a
|
|
18
|
+
# completion, which is required for path completions (so the user can keep typing
|
|
19
|
+
# a subdirectory) and for flag names (so '=' can follow immediately).
|
|
20
|
+
CDS_COMMAND="cds"
|
|
21
|
+
|
|
22
|
+
_completeCds()
|
|
23
|
+
{
|
|
24
|
+
local current previous cmd
|
|
25
|
+
COMPREPLY=()
|
|
26
|
+
current="${COMP_WORDS[COMP_CWORD]}"
|
|
27
|
+
previous="${COMP_WORDS[COMP_CWORD - 1]}"
|
|
28
|
+
# The subcommand is always the second token (index 1).
|
|
29
|
+
cmd="${COMP_WORDS[1]}"
|
|
30
|
+
# Step 1: resolve single-character shortcuts to their canonical command name
|
|
31
|
+
# so that subsequent case statements only need to handle canonical names.
|
|
32
|
+
case "$cmd" in
|
|
33
|
+
i) cmd=init ;;
|
|
34
|
+
a) cmd=add ;;
|
|
35
|
+
y) cmd=bind ;;
|
|
36
|
+
m) cmd=import ;;
|
|
37
|
+
c) cmd=compile ;;
|
|
38
|
+
p) cmd=parse ;;
|
|
39
|
+
s) cmd=serve ;;
|
|
40
|
+
w) cmd=watch ;;
|
|
41
|
+
e) cmd=env ;;
|
|
42
|
+
b) cmd=build ;;
|
|
43
|
+
d) cmd=deploy ;;
|
|
44
|
+
l) cmd=login ;;
|
|
45
|
+
o) cmd=logout ;;
|
|
46
|
+
t) cmd=test ;;
|
|
47
|
+
v) cmd=version ;;
|
|
48
|
+
h) cmd=help ;;
|
|
49
|
+
r) cmd=repl ;;
|
|
50
|
+
esac
|
|
51
|
+
|
|
52
|
+
# Step 2: top-level — offer all known subcommands when no subcommand has been
|
|
53
|
+
# typed yet (COMP_WORDS includes the command itself, so ≤ 2 means "cds <cursor>").
|
|
54
|
+
if [[ "${#COMP_WORDS[@]}" -le 2 ]]; then
|
|
55
|
+
COMPREPLY=( $(compgen -W ""add" "bind" "build" "compile" "completion" "debug" "deploy" "env" "eval" "export" "gen" "help" "import" "init" "inspect" "lint" "login" "logout" "minify" "mock" "parse" "pull" "push" "repl" "run" "serve" "subscribe" "test" "unsubscribe" "up" "upgrade" "upgrade-tenant" "version" "watch"" -- "$current") )
|
|
56
|
+
compopt -o nospace
|
|
57
|
+
return 0
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Step 3: flag/option completion — only triggered when the token starts with '-'.
|
|
61
|
+
if [[ "$current" == -* ]]; then
|
|
62
|
+
case "$cmd" in
|
|
63
|
+
add) COMPREPLY=( $(compgen -W ""--base" "--cdm" "--cloudevents" "--content-type" "--data:for" "--dry" "--filter" "--for" "--for-app" "--force" "--into" "--java:mvn" "--keys-only" "--out" "--package" "--plan" "--records" "--sap" "--shell" "--unified-runtime" "--with-telemetry" "--y"" -- "$current") ) ;;
|
|
64
|
+
bind) COMPREPLY=( $(compgen -W ""--credentials" "--exec" "--for" "--kind" "--no-create-service-key" "--on" "--out" "--output-file" "--to" "--to-app-services"" -- "$current") ) ;;
|
|
65
|
+
build) COMPREPLY=( $(compgen -W ""--dest" "--for" "--log-level" "--no-clean" "--no-ws-pack" "--options-model" "--opts" "--project" "--src" "--ws" "--ws-pack"" -- "$current") ) ;;
|
|
66
|
+
compile) COMPREPLY=( $(compgen -W ""--all" "--asyncapi:merged" "--beta" "--clean" "--conceptual" "--dest" "--dialect" "--docs" "--files" "--flavor" "--for" "--from" "--lang" "--locations" "--log-level" "--min" "--odata-version" "--openapi:config-file" "--openapi:diagram" "--openapi:servers" "--openapi:url" "--parse" "--plain" "--resolved" "--service" "--sort" "--sources" "--sql-dialect" "--to"" -- "$current") ) ;;
|
|
67
|
+
completion) COMPREPLY=( $(compgen -W ""--add" "--curr" "--generate" "--line" "--prev" "--profile" "--remove" "--shell"" -- "$current") ) ;;
|
|
68
|
+
debug) COMPREPLY=( $(compgen -W ""--cf" "--force" "--host" "--k8s" "--no-devtools" "--port"" -- "$current") ) ;;
|
|
69
|
+
deploy) COMPREPLY=( $(compgen -W ""--auto-undeploy" "--delta-from" "--dry" "--for" "--model-only" "--no-build" "--no-save" "--on" "--out" "--resolve-bindings" "--script" "--store-credentials" "--to" "--tunnel-address" "--vcap-file" "--with-auto-schema-evolution" "--with-mocks" "--xdry"" -- "$current") ) ;;
|
|
70
|
+
env) COMPREPLY=( $(compgen -W ""--for" "--json" "--keys" "--list" "--mocked" "--process-env" "--properties" "--raw" "--resolve-bindings" "--sources"" -- "$current") ) ;;
|
|
71
|
+
export) COMPREPLY=( $(compgen -W ""--artifact" "--as" "--cleanse" "--data" "--debug" "--dry" "--for" "--from" "--inspect" "--keep" "--mvn" "--plugin" "--reuse" "--services" "--skip" "--texts" "--to"" -- "$current") ) ;;
|
|
72
|
+
import) COMPREPLY=( $(compgen -W ""--as" "--asyncapi" "--config" "--data-product" "--dependencies" "--destination" "--dry" "--edmx" "--for" "--force" "--from" "--group" "--include-namespaces" "--into-namespace" "--keep-namespace" "--name" "--no-copy" "--no-save" "--odata" "--odata-v2-annotations" "--openapi" "--out" "--resolve-bindings" "--rfc" "--services"" -- "$current") ) ;;
|
|
73
|
+
init) COMPREPLY=( $(compgen -W ""--add" "--base" "--force" "--java" "--java:mvn" "--java:package" "--lint:custom" "--lint:custom:example" "--no-db" "--nodejs" "--verbose"" -- "$current") ) ;;
|
|
74
|
+
inspect) COMPREPLY=( $(compgen -W ""--kind" "--list" "--stats"" -- "$current") ) ;;
|
|
75
|
+
lint) COMPREPLY=( $(compgen -W ""--cache" "--cache-file" "--cache-location" "--cache-strategy" "--color" "--concurrency" "--config" "--debug" "--env-info" "--exit-on-fatal-error" "--ext" "--fix" "--fix-dry-run" "--fix-type" "--flag" "--format" "--global" "--help" "--ignore-pattern" "--init" "--inspect-config" "--max-warnings" "--mcp" "--no-color" "--no-config-lookup" "--no-error-on-unmatched-pattern" "--no-ignore" "--no-inline-config" "--no-warn-ignored" "--output-file" "--parser" "--parser-options" "--pass-on-no-patterns" "--pass-on-unpruned-suppressions" "--plugin" "--print-config" "--prune-suppressions" "--quiet" "--report-unused-disable-directives" "--report-unused-disable-directives-severity" "--report-unused-inline-configs" "--rule" "--stats" "--stdin" "--stdin-filename" "--suppress-all" "--suppress-rule" "--suppressions-location" "--version"" -- "$current") ) ;;
|
|
76
|
+
login) COMPREPLY=( $(compgen -W ""--client" "--mtls" "--passcode" "--plain" "--save-refresh-token" "--subdomain" "--user"" -- "$current") ) ;;
|
|
77
|
+
logout) COMPREPLY=( $(compgen -W ""--clear-invalid" "--delete-settings" "--subdomain" "--url"" -- "$current") ) ;;
|
|
78
|
+
minify) COMPREPLY=( $(compgen -W ""--cleanse" "--debug" "--dry" "--inspect" "--keep" "--skip"" -- "$current") ) ;;
|
|
79
|
+
mock) COMPREPLY=( $(compgen -W ""--at" "--from" "--in-memory" "--in-memory?" "--mocked" "--port" "--project" "--projects" "--resolve-bindings" "--service" "--to" "--watch" "--with" "--with-bindings" "--with-mocks" "--with-mtx" "--workers"" -- "$current") ) ;;
|
|
80
|
+
parse) COMPREPLY=( $(compgen -W ""--all" "--asyncapi:merged" "--beta" "--clean" "--conceptual" "--dest" "--dialect" "--docs" "--files" "--flavor" "--for" "--from" "--lang" "--locations" "--log-level" "--min" "--odata-version" "--openapi:config-file" "--openapi:diagram" "--openapi:servers" "--openapi:url" "--parse" "--plain" "--resolved" "--service" "--sort" "--sources" "--sql-dialect" "--to"" -- "$current") ) ;;
|
|
81
|
+
pull) COMPREPLY=( $(compgen -W ""--client" "--from" "--mtls" "--passcode" "--subdomain" "--user"" -- "$current") ) ;;
|
|
82
|
+
push) COMPREPLY=( $(compgen -W ""--async" "--client" "--mtls" "--passcode" "--subdomain" "--sync" "--to" "--user"" -- "$current") ) ;;
|
|
83
|
+
repl) COMPREPLY=( $(compgen -W ""--ql" "--run" "--use"" -- "$current") ) ;;
|
|
84
|
+
run) COMPREPLY=( $(compgen -W ""--at" "--from" "--in-memory" "--in-memory?" "--mocked" "--port" "--project" "--projects" "--resolve-bindings" "--service" "--to" "--watch" "--with" "--with-bindings" "--with-mocks" "--with-mtx" "--workers"" -- "$current") ) ;;
|
|
85
|
+
serve) COMPREPLY=( $(compgen -W ""--at" "--from" "--in-memory" "--in-memory?" "--mocked" "--port" "--project" "--projects" "--resolve-bindings" "--service" "--to" "--watch" "--with" "--with-bindings" "--with-mocks" "--with-mtx" "--workers"" -- "$current") ) ;;
|
|
86
|
+
subscribe) COMPREPLY=( $(compgen -W ""--body" "--local" "--resolve-bindings" "--to" "--user"" -- "$current") ) ;;
|
|
87
|
+
test) COMPREPLY=( $(compgen -W ""--exclude" "--failed" "--files" "--include" "--list" "--passed" "--quiet" "--recent" "--silent" "--timeout" "--unmute" "--verbose" "--workers"" -- "$current") ) ;;
|
|
88
|
+
unsubscribe) COMPREPLY=( $(compgen -W ""--from" "--local" "--resolve-bindings" "--user"" -- "$current") ) ;;
|
|
89
|
+
up) COMPREPLY=( $(compgen -W ""--namespace" "--overlay" "--to"" -- "$current") ) ;;
|
|
90
|
+
upgrade) COMPREPLY=( $(compgen -W ""--at" "--fix" "--local" "--report" "--resolve-bindings" "--user"" -- "$current") ) ;;
|
|
91
|
+
upgrade-tenant) COMPREPLY=( $(compgen -W ""--at" "--local" "--resolve-bindings" "--user"" -- "$current") ) ;;
|
|
92
|
+
version) COMPREPLY=( $(compgen -W ""--abs" "--all" "--depth" "--info" "--json" "--markdown" "--omit"" -- "$current") ) ;;
|
|
93
|
+
watch) COMPREPLY=( $(compgen -W ""--debug" "--exclude" "--experimental-hot-reload" "--ext" "--in-memory" "--in-memory?" "--include" "--inspect" "--inspect-brk" "--livereload" "--open" "--port" "--with-mocks" "--with-mtx"" -- "$current") ) ;;
|
|
94
|
+
esac
|
|
95
|
+
if [[ "${#COMPREPLY[@]}" -gt 0 ]]; then
|
|
96
|
+
compopt -o nospace
|
|
97
|
+
return 0
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Step 3.5: option-value completion — triggered when the previous word is a known option.
|
|
102
|
+
case "$cmd" in
|
|
103
|
+
bind)
|
|
104
|
+
case "$previous" in
|
|
105
|
+
--on) COMPREPLY=( $(compgen -W ""cf" "k8s"" -- "$current") ) ; return 0 ;;
|
|
106
|
+
--out) COMPREPLY=( $(compgen -f -- "$current") ) ; return 0 ;;
|
|
107
|
+
--output-file) COMPREPLY=( $(compgen -f -- "$current") ) ; return 0 ;;
|
|
108
|
+
esac ;;
|
|
109
|
+
build)
|
|
110
|
+
case "$previous" in
|
|
111
|
+
--for) COMPREPLY=( $(compgen -W ""hana" "helm" "java" "mtx" "mtx-extension" "mtx-sidecar" "nodejs"" -- "$current") ) ; return 0 ;;
|
|
112
|
+
--log-level) COMPREPLY=( $(compgen -W ""debug" "info" "warn" "error"" -- "$current") ) ; return 0 ;;
|
|
113
|
+
--dest) COMPREPLY=( $(compgen -d -- "$current") ) ; return 0 ;;
|
|
114
|
+
--src) COMPREPLY=( $(compgen -d -- "$current") ) ; return 0 ;;
|
|
115
|
+
esac ;;
|
|
116
|
+
compile)
|
|
117
|
+
case "$previous" in
|
|
118
|
+
--to) COMPREPLY=( $(compgen -W ""json" "yml" "edm" "edmx" "edmx-v2" "edmx-v4" "sql" "hdbtable" "hana" "cdl" "xsuaa" "openapi" "asyncapi"" -- "$current") ) ; return 0 ;;
|
|
119
|
+
--for) COMPREPLY=( $(compgen -W ""odata" "sql"" -- "$current") ) ; return 0 ;;
|
|
120
|
+
--dialect) COMPREPLY=( $(compgen -W ""sqlite" "h2" "postgres" "hana"" -- "$current") ) ; return 0 ;;
|
|
121
|
+
--sql-dialect) COMPREPLY=( $(compgen -W ""sqlite" "h2" "postgres" "hana"" -- "$current") ) ; return 0 ;;
|
|
122
|
+
--log-level) COMPREPLY=( $(compgen -W ""debug" "info" "warn" "error"" -- "$current") ) ; return 0 ;;
|
|
123
|
+
--odata-version) COMPREPLY=( $(compgen -W ""4.0" "4.01"" -- "$current") ) ; return 0 ;;
|
|
124
|
+
--flavor) COMPREPLY=( $(compgen -W ""sources" "files" "parsed" "xtended" "inferred"" -- "$current") ) ; return 0 ;;
|
|
125
|
+
--service) COMPREPLY=( $(compgen -W ""all"" -- "$current") ) ; return 0 ;;
|
|
126
|
+
--lang) COMPREPLY=( $(compgen -W ""all"" -- "$current") ) ; return 0 ;;
|
|
127
|
+
--dest) COMPREPLY=( $(compgen -d -- "$current") ) ; return 0 ;;
|
|
128
|
+
esac ;;
|
|
129
|
+
completion)
|
|
130
|
+
case "$previous" in
|
|
131
|
+
--shell) COMPREPLY=( $(compgen -W ""bash" "fish" "gitbash" "ps" "zsh"" -- "$current") ) ; return 0 ;;
|
|
132
|
+
esac ;;
|
|
133
|
+
deploy)
|
|
134
|
+
case "$previous" in
|
|
135
|
+
--to) COMPREPLY=( $(compgen -W ""sqlite" "hana"" -- "$current") ) ; return 0 ;;
|
|
136
|
+
--on) COMPREPLY=( $(compgen -W ""cf" "k8s"" -- "$current") ) ; return 0 ;;
|
|
137
|
+
esac ;;
|
|
138
|
+
import)
|
|
139
|
+
case "$previous" in
|
|
140
|
+
--from) COMPREPLY=( $(compgen -W ""asyncapi" "edmx" "openapi"" -- "$current") ) ; return 0 ;;
|
|
141
|
+
--as) COMPREPLY=( $(compgen -W ""cds" "csn" "json"" -- "$current") ) ; return 0 ;;
|
|
142
|
+
esac ;;
|
|
143
|
+
init)
|
|
144
|
+
case "$previous" in
|
|
145
|
+
--java:package) COMPREPLY=( $(compgen -d -- "$current") ) ; return 0 ;;
|
|
146
|
+
esac ;;
|
|
147
|
+
inspect)
|
|
148
|
+
case "$previous" in
|
|
149
|
+
--kind) COMPREPLY=( $(compgen -W ""entity" "aspect" "type" "service"" -- "$current") ) ; return 0 ;;
|
|
150
|
+
esac ;;
|
|
151
|
+
parse)
|
|
152
|
+
case "$previous" in
|
|
153
|
+
--to) COMPREPLY=( $(compgen -W ""json" "yml" "edm" "edmx" "edmx-v2" "edmx-v4" "sql" "hdbtable" "hana" "cdl" "xsuaa" "openapi" "asyncapi"" -- "$current") ) ; return 0 ;;
|
|
154
|
+
--for) COMPREPLY=( $(compgen -W ""odata" "sql"" -- "$current") ) ; return 0 ;;
|
|
155
|
+
--dialect) COMPREPLY=( $(compgen -W ""sqlite" "h2" "postgres" "hana"" -- "$current") ) ; return 0 ;;
|
|
156
|
+
--sql-dialect) COMPREPLY=( $(compgen -W ""sqlite" "h2" "postgres" "hana"" -- "$current") ) ; return 0 ;;
|
|
157
|
+
--log-level) COMPREPLY=( $(compgen -W ""debug" "info" "warn" "error"" -- "$current") ) ; return 0 ;;
|
|
158
|
+
--odata-version) COMPREPLY=( $(compgen -W ""4.0" "4.01"" -- "$current") ) ; return 0 ;;
|
|
159
|
+
--flavor) COMPREPLY=( $(compgen -W ""sources" "files" "parsed" "xtended" "inferred"" -- "$current") ) ; return 0 ;;
|
|
160
|
+
--service) COMPREPLY=( $(compgen -W ""all"" -- "$current") ) ; return 0 ;;
|
|
161
|
+
--lang) COMPREPLY=( $(compgen -W ""all"" -- "$current") ) ; return 0 ;;
|
|
162
|
+
--dest) COMPREPLY=( $(compgen -d -- "$current") ) ; return 0 ;;
|
|
163
|
+
esac ;;
|
|
164
|
+
up)
|
|
165
|
+
case "$previous" in
|
|
166
|
+
--to) COMPREPLY=( $(compgen -W ""cf" "k8s"" -- "$current") ) ; return 0 ;;
|
|
167
|
+
esac ;;
|
|
168
|
+
version)
|
|
169
|
+
case "$previous" in
|
|
170
|
+
--omit) COMPREPLY=( $(compgen -W ""dev" "optional" "peer"" -- "$current") ) ; return 0 ;;
|
|
171
|
+
esac ;;
|
|
172
|
+
watch)
|
|
173
|
+
case "$previous" in
|
|
174
|
+
--experimental-hot-reload) COMPREPLY=( $(compgen -W ""true" "false"" -- "$current") ) ; return 0 ;;
|
|
175
|
+
--livereload) COMPREPLY=( $(compgen -W ""false"" -- "$current") ) ; return 0 ;;
|
|
176
|
+
--include) COMPREPLY=( $(compgen -d -- "$current") ) ; return 0 ;;
|
|
177
|
+
--exclude) COMPREPLY=( $(compgen -d -- "$current") ) ; return 0 ;;
|
|
178
|
+
esac ;;
|
|
179
|
+
|
|
180
|
+
esac
|
|
181
|
+
|
|
182
|
+
# Step 3.6: comma-separated option-value completion.
|
|
183
|
+
# Splits $current on commas, filters out already-used values, prepends the prefix.
|
|
184
|
+
case "$cmd" in
|
|
185
|
+
add)
|
|
186
|
+
case "$previous" in
|
|
187
|
+
*)
|
|
188
|
+
[[ "$previous" == -* ]] && return 0
|
|
189
|
+
local prefix="" partial="" IFS=,
|
|
190
|
+
if [[ "$current" == *,* ]]; then
|
|
191
|
+
prefix="${current%,*},"
|
|
192
|
+
partial="${current##*,}"
|
|
193
|
+
else
|
|
194
|
+
partial="$current"
|
|
195
|
+
fi
|
|
196
|
+
local -a _used
|
|
197
|
+
read -ra _used <<< "${prefix%,}"
|
|
198
|
+
local _all=("ai" "ams" "app-frontend" "application-logging" "approuter" "attachments" "audit-logging" "cf-manifest" "cjs" "cloud-logging" "completion" "connectivity" "console" "data" "destination" "dynatrace" "enterprise-messaging" "enterprise-messaging-shared" "event-mesh" "event-mesh-shared" "extensibility" "extension" "file-based-messaging" "github-actions" "h2" "hana" "hana-serverless" "handler" "html5-repo" "http" "ias" "initial" "kafka" "kyma" "lint" "liquibase" "local-messaging" "malware-scanner" "mta" "mtx" "multitenancy" "notifications" "pipeline" "portal" "postgres" "react" "redis" "redis-messaging" "sample" "side-by-side-extensibility" "sqlite" "telemetry" "test" "tiny-sample" "toggles" "typer" "typescript" "ui5" "vue" "workzone" "workzone-standard" "xsuaa")
|
|
199
|
+
for v in "${_all[@]}"; do
|
|
200
|
+
[[ " ${_used[*]} " == *" $v "* ]] && continue
|
|
201
|
+
[[ "$v" == "$partial"* ]] && COMPREPLY+=("$prefix$v")
|
|
202
|
+
done
|
|
203
|
+
[[ ${#COMPREPLY[@]} -gt 0 ]] && { compopt -o nospace; return 0; } ;;
|
|
204
|
+
esac ;;
|
|
205
|
+
init)
|
|
206
|
+
case "$previous" in
|
|
207
|
+
--add)
|
|
208
|
+
local prefix="" partial="" IFS=,
|
|
209
|
+
if [[ "$current" == *,* ]]; then
|
|
210
|
+
prefix="${current%,*},"
|
|
211
|
+
partial="${current##*,}"
|
|
212
|
+
else
|
|
213
|
+
partial="$current"
|
|
214
|
+
fi
|
|
215
|
+
local -a _used
|
|
216
|
+
read -ra _used <<< "${prefix%,}"
|
|
217
|
+
local _all=("ai" "ams" "app-frontend" "application-logging" "approuter" "attachments" "audit-logging" "cf-manifest" "cjs" "cloud-logging" "completion" "connectivity" "console" "data" "destination" "dynatrace" "enterprise-messaging" "enterprise-messaging-shared" "event-mesh" "event-mesh-shared" "extensibility" "extension" "file-based-messaging" "github-actions" "h2" "hana" "hana-serverless" "handler" "html5-repo" "http" "ias" "initial" "kafka" "kyma" "lint" "liquibase" "local-messaging" "malware-scanner" "mta" "mtx" "multitenancy" "notifications" "pipeline" "portal" "postgres" "react" "redis" "redis-messaging" "sample" "side-by-side-extensibility" "sqlite" "telemetry" "test" "tiny-sample" "toggles" "typer" "typescript" "ui5" "vue" "workzone" "workzone-standard" "xsuaa")
|
|
218
|
+
for v in "${_all[@]}"; do
|
|
219
|
+
[[ " ${_used[*]} " == *" $v "* ]] && continue
|
|
220
|
+
[[ "$v" == "$partial"* ]] && COMPREPLY+=("$prefix$v")
|
|
221
|
+
done
|
|
222
|
+
[[ ${#COMPREPLY[@]} -gt 0 ]] && { compopt -o nospace; return 0; } ;;
|
|
223
|
+
esac ;;
|
|
224
|
+
|
|
225
|
+
esac
|
|
226
|
+
|
|
227
|
+
# Step 4: file-sentinel positionals — fill COMPREPLY with files and return.
|
|
228
|
+
case "$cmd" in
|
|
229
|
+
compile) COMPREPLY=( $(compgen -f -- "$current" | grep -E '\.(cds|json)$') ) ;;
|
|
230
|
+
deploy) COMPREPLY=( $(compgen -f -- "$current" | grep -E '\.(cds|json)$') ) ;;
|
|
231
|
+
import) COMPREPLY=( $(compgen -f -- "$current" | grep -E '\.(json|xml|edmx)$') ) ;;
|
|
232
|
+
inspect) COMPREPLY=( $(compgen -f -- "$current" | grep -E '\.(cds|json)$') ) ;;
|
|
233
|
+
parse) COMPREPLY=( $(compgen -f -- "$current" | grep -E '\.(cds|json)$') ) ;;
|
|
234
|
+
esac
|
|
235
|
+
if [[ "${#COMPREPLY[@]}" -gt 0 ]]; then
|
|
236
|
+
compopt -o nospace
|
|
237
|
+
return 0
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
# Step 4.6: string positionals (e.g. cds help <tab>).
|
|
241
|
+
case "$cmd" in
|
|
242
|
+
help) COMPREPLY=( $(compgen -W ""add" "bind" "build" "compile" "completion" "debug" "deploy" "env" "eval" "export" "gen" "help" "import" "init" "inspect" "lint" "login" "logout" "minify" "mock" "parse" "pull" "push" "repl" "run" "serve" "subscribe" "test" "unsubscribe" "up" "upgrade" "upgrade-tenant" "version" "watch"" -- "$current") ) ;;
|
|
243
|
+
esac
|
|
244
|
+
if [[ "${#COMPREPLY[@]}" -gt 0 ]]; then
|
|
245
|
+
compopt -o nospace
|
|
246
|
+
return 0
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
# Step 5: dynamic fallback — calls 'cds completion' for subcommands whose arguments
|
|
250
|
+
# cannot be determined statically (e.g. service names, model names, unknown flags).
|
|
251
|
+
# Single-quoting $previous/$current prevents bare word 'h' from being interpreted
|
|
252
|
+
# as the 'help' shortcut by the completion handler before it is processed.
|
|
253
|
+
local options
|
|
254
|
+
options=$($CDS_COMMAND completion --shell bash --prev "'$previous'" --curr "'$current'" --line "'${COMP_WORDS[*]}'")
|
|
255
|
+
COMPREPLY=( $(compgen -W "${options}" -- "${current}") )
|
|
256
|
+
compopt -o nospace
|
|
257
|
+
return 0
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
# Register the completion function for the 'cds' command.
|
|
261
|
+
complete -F _completeCds "$CDS_COMMAND"
|