diff --git a/.talismanrc b/.talismanrc index 84e0e09..e560723 100644 --- a/.talismanrc +++ b/.talismanrc @@ -307,7 +307,7 @@ fileignoreconfig: - filename: src/core/search-list.test.ts checksum: 0c324ecf8de5cc2fc1ccc27223cae555d7db6c8061c4bd7288e0dc7fb28f6b87 - filename: src/core/catalog.test.ts - checksum: ec946f9a2802dfe71db501ac1fa10ceaac6fe29ef5e98ade40a11330e60718f7 + checksum: 950d5cbb8ebdbe13cf13908b72d5409f7fdf7515c9d93a7c84045efcf4420543 - filename: test/credential-guard.setup.ts checksum: 519ccbeb0552fdb1d5f27308c56477c0258ee6cc0adec8f618e8e5bc047cbf6d - filename: src/environments/types.ts @@ -331,7 +331,7 @@ fileignoreconfig: - filename: src/commands/launch/env/update.test.ts checksum: 2da219594e7bdd589adc0eff9ff035252a75aaa51dfa20514b18fd3266d7b752 - filename: README.md - checksum: d955f95b66f10259eb2ddbe1935a67ce3c7f3a28187f0398e0af39ff75267c01 + checksum: a3c7d1fc273e7b5b818f0a7f05664fd7ddbb05c2f2eb44c28b5d496aad828508 allowed_patterns: - "password-protection" - "-p, --password" diff --git a/README.md b/README.md index da7eeea..9c95334 100644 --- a/README.md +++ b/README.md @@ -116,12 +116,12 @@ Purge an environment's CDN cache by path, cache tags or hostnames ``` USAGE - $ csdx launch:cache:purge [-c ] [-d ] [--org ] [--project ] [--env ] [--path + $ csdx launch:cache:purge [--config ] [-d ] [--org ] [--project ] [--env ] [--path ] [--prefix] [--tags ] [--hosts ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --hosts= Comma-separated hostnames to purge --org= Organization UID @@ -169,12 +169,12 @@ Cancel a deployment of a Launch environment that is still in progress ``` USAGE - $ csdx launch:deployments:cancel [-c ] [-d ] [--org ] [--project ] [--env ] [--deployment - ] [--yes] + $ csdx launch:deployments:cancel [--config ] [-d ] [--org ] [--project ] [--env ] + [--deployment ] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --deployment= Deployment UID --env= Environment name or UID --org= Organization UID @@ -198,14 +198,14 @@ Deploy a Launch environment: the branch tip or a chosen commit on a GitHub proje ``` USAGE - $ csdx launch:deployments:create [-c ] [-d ] [--org ] [--project ] [--env ] [--commit - | --last-upload] + $ csdx launch:deployments:create [--config ] [-d ] [--org ] [--project ] [--env ] + [--commit | --last-upload] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory --commit= GitHub projects: deploy this commit. Pass --commit with no value to pick one from the recent commits + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --last-upload FileUpload projects: redeploy the last uploaded bundle without uploading a new one --org= Organization UID @@ -231,12 +231,12 @@ Show a deployment of a Launch environment, the latest one unless --deployment na ``` USAGE - $ csdx launch:deployments:get [-c ] [-d ] [--org ] [--project ] [--env ] [--deployment - ] + $ csdx launch:deployments:get [--config ] [-d ] [--org ] [--project ] [--env ] + [--deployment ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --deployment= Deployment UID --env= Environment name or UID --org= Organization UID @@ -259,12 +259,12 @@ List the deployments of a Launch environment ``` USAGE - $ csdx launch:deployments:list [-c ] [-d ] [--org ] [--project ] [--env ] [--limit + $ csdx launch:deployments:list [--config ] [-d ] [--org ] [--project ] [--env ] [--limit ] [--skip ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --limit= Number of records to fetch (1-1000) --org= Organization UID @@ -286,12 +286,12 @@ Roll a Launch environment back to a previous deployment ``` USAGE - $ csdx launch:deployments:rollback [-c ] [-d ] [--org ] [--project ] [--env ] [--deployment - ] [--reason ] [--yes] + $ csdx launch:deployments:rollback [--config ] [-d ] [--org ] [--project ] [--env ] + [--deployment ] [--reason ] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --deployment= Deployment UID --env= Environment name or UID --org= Organization UID @@ -316,7 +316,7 @@ Create an environment in a Launch project and follow its first deployment ``` USAGE - $ csdx launch:env:create [-c ] [-d ] [--org ] [--project ] [--name ] + $ csdx launch:env:create [--config ] [-d ] [--org ] [--project ] [--name ] [--description ] [--branch ] [--framework ] [--build-cmd ] [--server-cmd ] [--output-dir ] [--res-mode ] [--auto-deploy ] [--cs-auth ] [--var ...] [--dotenv ...] [--from-stack] [-a ] @@ -324,11 +324,11 @@ USAGE FLAGS -a, --alias= Alias of a delivery token saved with csdx auth:tokens:add, used with --from-stack without a prompt - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory --auto-deploy= Deploy on every push, GitHub projects only (enable | disable) --branch= Git branch name, GitHub projects only --build-cmd= Build command + --config= Path to the local '.cs-launch.json' file --cs-auth= Contentstack Authentication (enable | disable) --description= Environment description (255 characters or fewer) --dotenv=... Path to a dotenv file, repeatable. Use - to read dotenv content from standard input @@ -362,11 +362,11 @@ Delete an environment of a Launch project ``` USAGE - $ csdx launch:env:delete [-c ] [-d ] [--org ] [--project ] [--env ] [--yes] + $ csdx launch:env:delete [--config ] [-d ] [--org ] [--project ] [--env ] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --org= Organization UID --project= Project name or UID @@ -389,11 +389,11 @@ Show a single environment of a Launch project ``` USAGE - $ csdx launch:env:get [-c ] [-d ] [--org ] [--project ] [--env ] + $ csdx launch:env:get [--config ] [-d ] [--org ] [--project ] [--env ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --org= Organization UID --project= Project name or UID @@ -413,12 +413,12 @@ List the environments of a Launch project ``` USAGE - $ csdx launch:env:list [-c ] [-d ] [--org ] [--project ] [--limit ] [--skip - ] + $ csdx launch:env:list [--config ] [-d ] [--org ] [--project ] [--limit ] + [--skip ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --limit= Number of records to fetch (1-1000) --org= Organization UID --project= Project name or UID @@ -439,13 +439,12 @@ Update an environment of a Launch project ``` USAGE - $ csdx launch:env:update [-c ] [-d ] [--org ] [--project ] [--env ] [--name + $ csdx launch:env:update [--config ] [-d ] [--org ] [--project ] [--env ] [--name ] [--description ] [--branch ] [--framework ] [--build-cmd ] [--server-cmd ] [--output-dir ] [--res-mode ] [--auto-deploy ] [--cs-auth ] [--cache-priming ] [--password-protection ] [-u ] [-p] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory -p, --password With --password-protection enable: read the password from standard input when there is no terminal (on a terminal it is asked at a hidden prompt) @@ -454,6 +453,7 @@ FLAGS --branch= Git branch name, GitHub projects only --build-cmd= Build command --cache-priming= Cache priming (enable | disable) + --config= Path to the local '.cs-launch.json' file --cs-auth= Contentstack Authentication (enable | disable) --description= Environment description (255 characters or fewer) --env= Environment name or UID @@ -558,12 +558,12 @@ Read the build or server logs of a deployment of a Launch environment ``` USAGE - $ csdx launch:logs:get [-c ] [-d ] [--org ] [--project ] [--env ] [--deployment - ] [--since ] [--until ] [--search ] [--cursor ] [--type ] + $ csdx launch:logs:get [--config ] [-d ] [--org ] [--project ] [--env ] + [--deployment ] [--since ] [--until ] [--search ] [--cursor ] [--type ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --cursor= Server logs only: resume from the cursor printed by an earlier run --deployment= Deployment UID --env= Environment name or UID @@ -607,19 +607,19 @@ Create a Launch project, its first environment, and its first deployment ``` USAGE - $ csdx launch:projects:create [-c ] [-d ] [--org ] [--type ] [--name ] [--description - ] [--env-name ] [--branch ] [--framework ] [--build-cmd ] [--server-cmd ] - [--output-dir ] [--res-mode ] [--auto-deploy ] [--cs-auth ] [--var ...] [--dotenv - ...] [--from-stack] [-a ] + $ csdx launch:projects:create [--config ] [-d ] [--org ] [--type ] [--name ] + [--description ] [--env-name ] [--branch ] [--framework ] [--build-cmd ] + [--server-cmd ] [--output-dir ] [--res-mode ] [--auto-deploy ] [--cs-auth ] + [--var ...] [--dotenv ...] [--from-stack] [-a ] FLAGS -a, --alias= Alias of a delivery token saved with csdx auth:tokens:add, used with --from-stack without a prompt - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory --auto-deploy= Deploy on every push, GitHub projects only (enable | disable) --branch= Git branch name, GitHub projects only --build-cmd= Build command + --config= Path to the local '.cs-launch.json' file --cs-auth= Contentstack Authentication (enable | disable) --description= Project description (255 characters or fewer) --dotenv=... Path to a dotenv file, repeatable. Use - to read dotenv content from standard input @@ -656,11 +656,11 @@ Delete a Launch project ``` USAGE - $ csdx launch:projects:delete [-c ] [-d ] [--org ] [--project ] [--yes] + $ csdx launch:projects:delete [--config ] [-d ] [--org ] [--project ] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --org= Organization UID --project= Project name or UID --yes Skip the confirmation prompt @@ -682,11 +682,11 @@ Show a single Launch project ``` USAGE - $ csdx launch:projects:get [-c ] [-d ] [--org ] [--project ] + $ csdx launch:projects:get [--config ] [-d ] [--org ] [--project ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --org= Organization UID --project= Project name or UID @@ -705,11 +705,11 @@ List Launch projects in an organization ``` USAGE - $ csdx launch:projects:list [-c ] [-d ] [--org ] [--limit ] [--skip ] + $ csdx launch:projects:list [--config ] [-d ] [--org ] [--limit ] [--skip ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --limit= Number of records to fetch (1-1000) --org= Organization UID --skip= Number of records to skip @@ -729,12 +729,12 @@ Update a Launch project ``` USAGE - $ csdx launch:projects:update [-c ] [-d ] [--org ] [--project ] [--name ] + $ csdx launch:projects:update [--config ] [-d ] [--org ] [--project ] [--name ] [--description ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --description= Project description (255 characters or fewer) --name= Project name (200 characters or fewer) --org= Organization UID @@ -773,11 +773,11 @@ List the secrets of an environment by key and update time; values are never show ``` USAGE - $ csdx launch:secrets:list [-c ] [-d ] [--org ] [--project ] [--env ] + $ csdx launch:secrets:list [--config ] [-d ] [--org ] [--project ] [--env ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --org= Organization UID --project= Project name or UID @@ -797,12 +797,12 @@ Add a secret to an environment, or replace its value when the key exists. Takes ``` USAGE - $ csdx launch:secrets:set [-c ] [-d ] [--org ] [--project ] [--env ] [--key + $ csdx launch:secrets:set [--config ] [-d ] [--org ] [--project ] [--env ] [--key ...] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --key=... Secret key --org= Organization UID @@ -827,12 +827,12 @@ Remove secrets from an environment, after asking for confirmation. Pass --key on ``` USAGE - $ csdx launch:secrets:unset [-c ] [-d ] [--org ] [--project ] [--env ] [--key + $ csdx launch:secrets:unset [--config ] [-d ] [--org ] [--project ] [--env ] [--key ...] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --key=... Secret key, repeatable --org= Organization UID @@ -857,12 +857,12 @@ Open an environment's live site in your browser, or print its URL when there is ``` USAGE - $ csdx launch:site:open [-c ] [-d ] [--org ] [--project ] [--env ] [--deployment - ] + $ csdx launch:site:open [--config ] [-d ] [--org ] [--project ] [--env ] + [--deployment ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --deployment= Deployment UID --env= Environment name or UID --org= Organization UID @@ -889,12 +889,12 @@ List the environment variables of an environment, with their values masked ``` USAGE - $ csdx launch:variables:list [-c ] [-d ] [--org ] [--project ] [--env ] [--limit + $ csdx launch:variables:list [--config ] [-d ] [--org ] [--project ] [--env ] [--limit ] [--skip ] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --limit= Number of records to fetch (1-1000) --org= Organization UID @@ -916,14 +916,14 @@ Add or change environment variables from --var, --dotenv or a detected .env file ``` USAGE - $ csdx launch:variables:set [-c ] [-d ] [--org ] [--project ] [--env ] [--var + $ csdx launch:variables:set [--config ] [-d ] [--org ] [--project ] [--env ] [--var ...] [--dotenv ...] [--from-stack] [-a ] FLAGS -a, --alias= Alias of a delivery token saved with csdx auth:tokens:add, used with --from-stack without a prompt - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --dotenv=... Path to a dotenv file, repeatable. Use - to read dotenv content from standard input --env= Environment name or UID --from-stack Import the variables of a Contentstack stack. Asks for the stack and a delivery token on a @@ -952,12 +952,12 @@ Remove environment variables from an environment, after asking for confirmation ``` USAGE - $ csdx launch:variables:unset [-c ] [-d ] [--org ] [--project ] [--env ] [--key + $ csdx launch:variables:unset [--config ] [-d ] [--org ] [--project ] [--env ] [--key ...] [--yes] FLAGS - -c, --config= Path to the local '.cs-launch.json' file -d, --data-dir= Current working directory + --config= Path to the local '.cs-launch.json' file --env= Environment name or UID --key=... Environment variable key, repeatable --org= Organization UID diff --git a/src/core/catalog.test.ts b/src/core/catalog.test.ts index d3d2f43..ee9a718 100644 --- a/src/core/catalog.test.ts +++ b/src/core/catalog.test.ts @@ -21,6 +21,18 @@ describe('coreFlags', () => { await expect(parse(['-y'])).rejects.toThrow(/Nonexistent flag: -y/); }); + it('gives --config no short flag', () => { + expect(coreFlags.config.char).toBeUndefined(); + }); + + it('still parses --config with its value', async () => { + await expect(parse(['--config', './.cs-launch.json'])).resolves.toMatchObject({ config: './.cs-launch.json' }); + }); + + it('rejects -c at parse time rather than reading it as --config', async () => { + await expect(parse(['-c', './.cs-launch.json'])).rejects.toThrow(/Nonexistent flag: -c/); + }); + it('advertises the limit range in the flag itself, not only in the help text', () => { expect(coreFlags.limit).toMatchObject({ min: 1, max: CLIENT_MAX_LIMIT }); expect(coreFlags.limit.description).toBe(`Number of records to fetch (1-${CLIENT_MAX_LIMIT})`); diff --git a/src/core/catalog.ts b/src/core/catalog.ts index 3af3e22..cb6a12c 100644 --- a/src/core/catalog.ts +++ b/src/core/catalog.ts @@ -10,6 +10,6 @@ export const coreFlags = { }), skip: Flags.integer({ min: 0, description: 'Number of records to skip' }), yes: Flags.boolean({ description: 'Skip the confirmation prompt' }), - config: Flags.string({ char: 'c', description: `Path to the local '${PROJECT_CONFIG_FILE}' file` }), + config: Flags.string({ description: `Path to the local '${PROJECT_CONFIG_FILE}' file` }), 'data-dir': Flags.string({ char: 'd', description: 'Current working directory' }), };