From 2bce08bb71c77f37d082600dea9017c9eaa71fbd Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Thu, 6 Jun 2024 16:25:19 -0700 Subject: [PATCH 1/7] Updating descriptions for command options --- src/bin/vip-config-software-update.js | 2 +- src/bin/vip-dev-env-create.js | 2 +- src/bin/vip-sync.js | 12 +++--- src/lib/cli/command.js | 32 +++++++++++---- .../dev-environment/dev-environment-cli.ts | 40 ++++++++++++++----- 5 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/bin/vip-config-software-update.js b/src/bin/vip-config-software-update.js index 54a52eb70..b8ad6251a 100755 --- a/src/bin/vip-config-software-update.js +++ b/src/bin/vip-config-software-update.js @@ -54,7 +54,7 @@ const cmd = command( { wildcardCommand: true, usage, } ).examples( examples ); -cmd.option( 'yes', 'Auto-confirm update' ); +cmd.option( 'yes', 'Skip the confirmation prompt and automatically submit "y".' ); cmd.argv( process.argv, async ( arg, opt ) => { const { app, env } = opt; const { softwareSettings } = env; diff --git a/src/bin/vip-dev-env-create.js b/src/bin/vip-dev-env-create.js index 627bdf2ff..790152e7d 100755 --- a/src/bin/vip-dev-env-create.js +++ b/src/bin/vip-dev-env-create.js @@ -71,7 +71,7 @@ const cmd = command( { undefined, processSlug ) - .option( 'title', 'A descriptive value for the WordPress Site Title. Default is "VIP Dev").' ) + .option( 'title', 'A descriptive value for the WordPress Site Title. Default is "VIP Dev".' ) .option( 'multisite', 'Create environment as a multisite. Accepts "y" for a subdomain multisite, "subdirectory" (recommended) for a subdirectory multisite, or "false". Default is "y".', diff --git a/src/bin/vip-sync.js b/src/bin/vip-sync.js index 2ad9840a0..4ffed4c5a 100755 --- a/src/bin/vip-sync.js +++ b/src/bin/vip-sync.js @@ -51,7 +51,7 @@ command( { let bail = false; for ( const err of error.graphQLErrors ) { - if ( err.message !== 'Site is already syncing' ) { + if ( err.message !== 'Site is already syncing.' ) { bail = true; console.log( chalk.red( 'Error:' ), err.message ); } @@ -92,10 +92,10 @@ command( { if ( syncing ) { if ( environment.syncProgress.status === 'running' ) { - console.log( chalk.yellow( 'Note:' ), 'A data sync is already running' ); + console.log( chalk.yellow( 'Note:' ), 'A data sync is already running.' ); } else { - console.log( chalk.yellow( 'Note:' ), 'Someone recently ran a data sync on this site' ); - console.log( chalk.yellow( 'Note:' ), 'Please wait a few minutes before trying again' ); + console.log( chalk.yellow( 'Note:' ), 'Someone recently ran a data sync on this site.' ); + console.log( chalk.yellow( 'Note:' ), 'Please wait a few minutes before trying again.' ); } } @@ -183,7 +183,7 @@ command( { error: 'API returned `failed` status', } ); - out.push( `${ marks.failed } Data Sync is finished for ${ opts.app.name }` ); + out.push( `${ marks.failed } Data Sync is finished for ${ opts.app.name }.` ); out.push( '' ); break; @@ -193,7 +193,7 @@ command( { await trackEvent( 'sync_command_success' ); - out.push( `${ marks.success } Data Sync is finished for ${ opts.app.name }` ); + out.push( `${ marks.success } Data Sync is finished for ${ opts.app.name }.` ); out.push( '' ); break; } diff --git a/src/lib/cli/command.js b/src/lib/cli/command.js index a00f6255e..f9f0dc9a8 100644 --- a/src/lib/cli/command.js +++ b/src/lib/cli/command.js @@ -470,7 +470,7 @@ args.argv = async function ( argv, cb ) { Boolean( options.exportFileErrorsToJson ) && ! [ 'false', 'no' ].includes( options.exportFileErrorsToJson ); info.push( { - key: 'Export any file errors encountered to a JSON file instead of a plain text file', + key: 'Export any file errors encountered to a JSON file instead of a plain text file.', value: options.exportFileErrorsToJson ? '✅ Yes' : `${ chalk.red( 'x' ) } No`, } ); break; @@ -566,25 +566,41 @@ export default function ( opts ) { }; if ( _opts.appContext || _opts.requireConfirm ) { - args.option( 'app', 'Specify the app' ); + args.option( + 'app', + 'Target an application. Accepts a string value for the application name or an integer for the application ID.' + ); } if ( _opts.envContext || _opts.childEnvContext ) { - args.option( 'env', 'Specify the environment' ); + args.option( 'env', 'Target an environment. Accepts a string value for the environment type.' ); } if ( _opts.requireConfirm ) { - args.option( 'force', 'Skip confirmation', false ); + args.option( 'force', 'Skip confirmation.', false ); } if ( _opts.format ) { - args.option( 'format', 'Format results', 'table' ); + args.option( + 'format', + 'Render output in a particular format. Accepts "table" (default), "csv", and "json".', + 'table' + ); } // Add help and version to all subcommands - args.option( 'help', 'Output the help for the (sub)command' ); - args.option( 'version', 'Output the version number' ); - args.option( 'debug', 'Activate debug output' ); + args.option( + 'help', + 'Retrieve a description, examples, and available options for a (sub)command.' + ); + args.option( + 'version', + 'Retrieve the version number of VIP-CLI currently installed on the local machine.' + ); + args.option( + 'debug', + 'Generate verbose output during command execution to help identify or fix errors or bugs.' + ); return args; } diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index db02791a6..0d53f608e 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -830,43 +830,61 @@ export function processVersionOption( value: unknown ): string { export function addDevEnvConfigurationOptions( command: Args ): Args { // We leave the third parameter to undefined on some because the defaults are handled in preProcessInstanceData() return command - .option( 'wordpress', 'Use a specific WordPress version', undefined, processVersionOption ) - .option( [ 'u', 'mu-plugins' ], 'Use a specific mu-plugins changeset or local directory' ) + .option( + 'wordpress', + 'Manage the version of WordPress. Accepts a string value for major versions (6.x). Defaults to the most recent version of WordPress.', + undefined, + processVersionOption + ) + .option( + [ 'u', 'mu-plugins' ], + 'Manage the source for VIP MU plugins. Accepts "demo" (default) for a read-only image of the staging branch, or a path to a built copy of VIP MU plugins on the local machine.' + ) .option( 'app-code', - 'Use the application code from a local directory or use "demo" for VIP skeleton code' + 'Manage the source for application code. Accepts "demo" (default) for a read-only image of WordPress skeleton code, or a path to a git cloned application repo on the local machine.' ) .option( 'phpmyadmin', - 'Enable PHPMyAdmin component. By default it is disabled', + 'Manage PHPMyAdmin, disabled by default. Accepts "y" (default value) to enable or "n" to disable. When enabled, refer to the value of PHPMYADMIN URLS in the information output for a local environment for the URL to access phpMyAdmin.', + undefined, + processBooleanOption + ) + .option( + 'xdebug', + 'Manage XDebug, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ) - .option( 'xdebug', 'Enable XDebug. By default it is disabled', undefined, processBooleanOption ) .option( 'xdebug_config', - 'Extra configuration to pass to xdebug via XDEBUG_CONFIG environment variable' + 'Override some default configuration settings for Xdebug. Accepts a string value that is assigned to the XDEBUG_CONFIG environment variable.' ) .option( 'elasticsearch', - 'Enable Elasticsearch (needed by Enterprise Search)', + 'Manage Elasticsearch (required by Enterprise Search), disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ) .option( [ 'r', 'media-redirect-domain' ], - 'Domain to redirect for missing media files. This can be used to still have images without the need to import them locally.' + 'Configure media files to be proxied from a VIP Platform environment. Accepts a string value for the primary domain of the VIP Platform environment or "n" to disable the media proxy.' + ) + .option( + 'php', + 'Manage the version of PHP. Accepts a string value for minor versions (8.x). Defaults to the most recent version of PHP.', + undefined, + processVersionOption ) - .option( 'php', 'Explicitly choose PHP version to use', undefined, processVersionOption ) .option( [ 'A', 'mailpit' ], - 'Enable Mailpit. By default it is disabled', + 'Manage Mailpit, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ) .option( [ 'H', 'photon' ], - 'Enable Photon. By default it is disabled', + 'Manage Photon, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ); From 53c2cb9df27af55fcb4bc9ac7cc6fb9145defd76 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Tue, 11 Jun 2024 09:45:27 -0700 Subject: [PATCH 2/7] Updates based on feedback --- src/lib/dev-environment/dev-environment-cli.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index 0d53f608e..95c06e1a4 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -842,11 +842,11 @@ export function addDevEnvConfigurationOptions( command: Args ): Args { ) .option( 'app-code', - 'Manage the source for application code. Accepts "demo" (default) for a read-only image of WordPress skeleton code, or a path to a git cloned application repo on the local machine.' + 'Manage the source for application code. Accepts "demo" (default) for a read-only image of WordPress VIP skeleton application code, or a path to a VIP formatted application repo on the local machine.' ) .option( 'phpmyadmin', - 'Manage PHPMyAdmin, disabled by default. Accepts "y" (default value) to enable or "n" to disable. When enabled, refer to the value of PHPMYADMIN URLS in the information output for a local environment for the URL to access phpMyAdmin.', + 'Manage phpMyAdmin, disabled by default. Accepts "y" (default value) to enable or "n" to disable. When enabled, refer to the value of "PHPMYADMIN URLS" in the information output for a local environment for the URL to access phpMyAdmin.', undefined, processBooleanOption ) From f939e73d7c9cfb9fbb1f02df632a9ee16b7ccda9 Mon Sep 17 00:00:00 2001 From: Terri Ann Swallow Date: Thu, 13 Jun 2024 12:28:49 -0400 Subject: [PATCH 3/7] Populate the dev-env help documentation with the supported PHP versions. --- src/lib/dev-environment/dev-environment-cli.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index 732f4d31c..f1aef124e 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -858,6 +858,8 @@ export function processVersionOption( value: unknown ): string { return value?.toString() ?? ''; } +const phpVersionsSupported: string = Object.keys(DEV_ENVIRONMENT_PHP_VERSIONS).join(', '); + export function addDevEnvConfigurationOptions( command: Args ): Args { // We leave the third parameter to undefined on some because the defaults are handled in preProcessInstanceData() return command @@ -905,7 +907,7 @@ export function addDevEnvConfigurationOptions( command: Args ): Args { ) .option( 'php', - 'Manage the version of PHP. Accepts a string value for minor versions (8.x). Defaults to the most recent version of PHP.', + `Manage the version of PHP. Accepts a string value for minor versions: ${phpVersionsSupported}.`, undefined, processVersionOption ) From 35f3de8b0ece8c249620db38c2a926ccc606cc6f Mon Sep 17 00:00:00 2001 From: Terri Ann Swallow Date: Thu, 13 Jun 2024 12:37:11 -0400 Subject: [PATCH 4/7] Correct linting errors --- src/lib/dev-environment/dev-environment-cli.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index f1aef124e..e397ce355 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -858,7 +858,7 @@ export function processVersionOption( value: unknown ): string { return value?.toString() ?? ''; } -const phpVersionsSupported: string = Object.keys(DEV_ENVIRONMENT_PHP_VERSIONS).join(', '); +const phpVersionsSupported: string = Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS ).join( ', ' ); export function addDevEnvConfigurationOptions( command: Args ): Args { // We leave the third parameter to undefined on some because the defaults are handled in preProcessInstanceData() @@ -907,7 +907,7 @@ export function addDevEnvConfigurationOptions( command: Args ): Args { ) .option( 'php', - `Manage the version of PHP. Accepts a string value for minor versions: ${phpVersionsSupported}.`, + `Manage the version of PHP. Accepts a string value for minor versions: ${ phpVersionsSupported }.`, undefined, processVersionOption ) From 2860a83120ae6dde7553b6117166ff4bba3cf07f Mon Sep 17 00:00:00 2001 From: Terri Ann Swallow Date: Thu, 13 Jun 2024 12:38:46 -0400 Subject: [PATCH 5/7] Remove trailing period since including it when passing the last option can result in a different value being used without user-facing indication. --- src/lib/dev-environment/dev-environment-cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index e397ce355..e7407ffb3 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -907,7 +907,7 @@ export function addDevEnvConfigurationOptions( command: Args ): Args { ) .option( 'php', - `Manage the version of PHP. Accepts a string value for minor versions: ${ phpVersionsSupported }.`, + `Manage the version of PHP. Accepts a string value for minor versions: ${ phpVersionsSupported }`, undefined, processVersionOption ) From 51ef1735a7d5b9b9694011456ae93c594eea9658 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Thu, 13 Jun 2024 10:09:02 -0700 Subject: [PATCH 6/7] Update to language as per feedback --- src/lib/dev-environment/dev-environment-cli.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/dev-environment/dev-environment-cli.ts b/src/lib/dev-environment/dev-environment-cli.ts index e7407ffb3..b30f15ae6 100644 --- a/src/lib/dev-environment/dev-environment-cli.ts +++ b/src/lib/dev-environment/dev-environment-cli.ts @@ -879,13 +879,13 @@ export function addDevEnvConfigurationOptions( command: Args ): Args { ) .option( 'phpmyadmin', - 'Manage phpMyAdmin, disabled by default. Accepts "y" (default value) to enable or "n" to disable. When enabled, refer to the value of "PHPMYADMIN URLS" in the information output for a local environment for the URL to access phpMyAdmin.', + 'Enable or disable phpMyAdmin, disabled by default. Accepts "y" (default value) to enable or "n" to disable. When enabled, refer to the value of "PHPMYADMIN URLS" in the information output for a local environment for the URL to access phpMyAdmin.', undefined, processBooleanOption ) .option( 'xdebug', - 'Manage XDebug, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', + 'Enable or disable XDebug, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ) @@ -895,7 +895,7 @@ export function addDevEnvConfigurationOptions( command: Args ): Args { ) .option( 'elasticsearch', - 'Manage Elasticsearch (required by Enterprise Search), disabled by default. Accepts "y" (default value) to enable or "n" to disable.', + 'Enable or disable Elasticsearch (required by Enterprise Search), disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ) @@ -913,13 +913,13 @@ export function addDevEnvConfigurationOptions( command: Args ): Args { ) .option( [ 'A', 'mailpit' ], - 'Manage Mailpit, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', + 'Enable or disable Mailpit, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ) .option( [ 'H', 'photon' ], - 'Manage Photon, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', + 'Enable or disable Photon, disabled by default. Accepts "y" (default value) to enable or "n" to disable.', undefined, processBooleanOption ); From f376713e7e0e81a2eae583357e70958b77314a13 Mon Sep 17 00:00:00 2001 From: Alexey Kopytko Date: Wed, 19 Jun 2024 08:30:24 +0900 Subject: [PATCH 7/7] Update src/bin/vip-sync.js --- src/bin/vip-sync.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/vip-sync.js b/src/bin/vip-sync.js index 4ffed4c5a..753ee3356 100755 --- a/src/bin/vip-sync.js +++ b/src/bin/vip-sync.js @@ -51,7 +51,7 @@ command( { let bail = false; for ( const err of error.graphQLErrors ) { - if ( err.message !== 'Site is already syncing.' ) { + if ( err.message !== 'Site is already syncing' ) { bail = true; console.log( chalk.red( 'Error:' ), err.message ); }