From 28bbcb5fdfe4c22ebe9056df32579a69c9e4fd02 Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Mon, 13 May 2024 08:52:13 -0700 Subject: [PATCH 1/5] First pass at updates to descriptions --- src/bin/vip-dev-env-create.js | 47 +++++++++++++---------------- src/bin/vip-dev-env-destroy.js | 20 +++++++----- src/bin/vip-dev-env-exec.js | 32 ++++++++++++-------- src/bin/vip-dev-env-import-media.js | 15 +++++---- src/bin/vip-dev-env-import-sql.js | 39 +++++++++++++++--------- src/bin/vip-dev-env-import.js | 18 ++++++----- src/bin/vip-dev-env-info.js | 25 +++++++++------ src/bin/vip-dev-env-list.js | 12 +++++--- src/bin/vip-dev-env-logs.js | 28 ++++++++--------- src/bin/vip-dev-env-purge.js | 28 +++++++++++------ src/bin/vip-dev-env-shell.js | 33 +++++++++++--------- src/bin/vip-dev-env-start.js | 33 ++++++++++++++------ src/bin/vip-dev-env-stop.js | 13 +++++--- src/bin/vip-dev-env-sync-sql.js | 12 +++++--- src/bin/vip-dev-env-sync.js | 11 ++++++- src/bin/vip-dev-env-update.js | 17 ++++++++--- src/bin/vip-dev-env.js | 29 ++++++++---------- src/bin/vip.js | 2 +- 18 files changed, 242 insertions(+), 172 deletions(-) diff --git a/src/bin/vip-dev-env-create.js b/src/bin/vip-dev-env-create.js index 3587dd658..d74bcee28 100755 --- a/src/bin/vip-dev-env-create.js +++ b/src/bin/vip-dev-env-create.js @@ -5,10 +5,6 @@ import debugLib from 'debug'; import command from '../lib/cli/command'; import * as exit from '../lib/cli/exit'; -import { - DEV_ENVIRONMENT_FULL_COMMAND, - DEV_ENVIRONMENT_SUBCOMMAND, -} from '../lib/constants/dev-environment'; import { DEFAULT_SLUG, getEnvironmentName, @@ -36,41 +32,40 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env create'; +const usage = 'vip dev-env create'; +// Command examples const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } create`, - description: 'Creates a local dev environment', - }, - { - usage: `vip @123.production ${ DEV_ENVIRONMENT_SUBCOMMAND } create`, - description: 'Creates a local dev environment for production site for id 123', + usage: exampleUsage, + description: 'Create a new VIP Local Development Environment.\n' + + ' * If a custom name is not assigned with "--slug" the environment will be named "vip-local" by default.', }, { - usage: `vip ${ DEV_ENVIRONMENT_SUBCOMMAND } create --slug=my_site`, - description: 'Creates a local dev environment aliased as "my_site"', - }, - { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } create --slug=test`, + usage: `${ exampleUsage } --slug=example-site`, description: - 'Assigning unique slugs to environments allows multiple environments to be created.', + 'Create a new local environment with the unique slug "example-site".\n' + + ' * Unique slugs allow multiple local environments to exist simultaneously.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } create --multisite --wordpress="5.8" --app-code="~/git/my_code"`, + usage: `${ exampleUsage } --slug=example-site --multisite=y --php=8.2 --wordpress=6.4`, description: - 'Creates a local multisite dev environment using WP 5.8 and application code is expected to be in "~/git/my_code"', + 'Create a new local environment configured as a multisite running PHP 8.2 and WordPress version 6.4.\n' + + ' * Options that are set in the command will be skipped in the setup wizard.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } create --multisite=subdirectory --wordpress="5.8" --app-code="~/git/my_code"`, - description: - 'Creates a local multisite dev environment with a subdirectory URL structure using WP 5.8 and application code is expected to be in "~/git/my_code"', + usage: `vip @example-app.production dev-env create --slug=example-site --app-code=/Users/example/Desktop/example-repo`, + description: 'Create a new local environment with settings based on the production environment of the "example-app" application and load the locally git-cloned application repository.', }, ]; -const cmd = command() - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( 'title', 'Title for the WordPress site' ) - .option( 'multisite', 'Enable multisite install', undefined, processStringOrBooleanOption ); +const cmd = command( { + usage, +} ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .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".', undefined, processStringOrBooleanOption ); addDevEnvConfigurationOptions( cmd ); @@ -155,7 +150,7 @@ cmd.argv( process.argv, async ( arg, opt ) => { const message = '\n' + chalk.green( '✓' ) + - ` environment created.\n\nTo start it please run:\n\n${ startCommand }\n`; + ` environment created.\n\nTo start the environment run:\n\n${ startCommand }\n`; console.log( message ); await trackEvent( 'dev_env_create_command_success', trackingInfo ); diff --git a/src/bin/vip-dev-env-destroy.js b/src/bin/vip-dev-env-destroy.js index 2ae1baec5..48067da7d 100755 --- a/src/bin/vip-dev-env-destroy.js +++ b/src/bin/vip-dev-env-destroy.js @@ -4,7 +4,6 @@ import chalk from 'chalk'; import debugLib from 'debug'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, getEnvironmentName, @@ -17,21 +16,26 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env destroy'; +const usage = 'vip dev-env destroy'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } destroy`, - description: 'Destroys the default local dev environment', + usage: `${ exampleUsage } --slug=example-site`, + description: 'Completely remove a local environment named "example-site" by removing all Docker containers, volumes, and configuration files.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } destroy --slug=foo`, - description: 'Destroys a local dev environment named foo', + usage: `${ exampleUsage } --soft --slug=example-site`, + description: 'Remove the Docker containers and volumes of a local environment named "example-site" but preserve the configuration files.\n' + + ' * The configuration files allow the local environment to be restarted with new Docker containers and volumes.', }, ]; -command() - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( 'soft', 'Keep config files needed to start an environment intact' ) +const cmd = command( { + usage, +} ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( 'soft', 'Preserve an environment\’s configuration files; allows an environment to be regenerated with the start command.' ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-exec.js b/src/bin/vip-dev-env-exec.js index 4ef0af9e2..5686cb3b4 100755 --- a/src/bin/vip-dev-env-exec.js +++ b/src/bin/vip-dev-env-exec.js @@ -1,7 +1,6 @@ #!/usr/bin/env node import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, getEnvironmentName, @@ -15,25 +14,32 @@ import { bootstrapLando, isEnvUp } from '../lib/dev-environment/dev-environment- import { trackEvent } from '../lib/tracker'; import UserError from '../lib/user-error'; +const exampleUsage = 'vip dev-env exec'; +const usage = 'vip dev-env exec'; + const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } exec -- wp post list`, - description: 'Use dev-environment to run `wp post list`', + usage: `${ exampleUsage } --slug=example-site -- wp post list`, + description: 'Run a WP-CLI command against a local environment named "example-site".\n' + + ' * A double dash ("--") must separate the arguments of "vip" from those of the "wp" command.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } exec --slug my_site -- wp post list --posts_per_page=500`, - description: 'Use dev-environment "my-site" to run `wp post list --posts_per_page=500`', + usage: `${ exampleUsage } --slug=example-site -- wp user list --url=example.example-site.vipdev.lndo.site`, + description: 'Target the WP-CLI command against the network site "example.example-site.vipdev.lndo.site" of a local multisite environment.`', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } exec --slug my_site -- wp shell`, - description: 'Use dev-environment "my_site" to run interactive wp shell', + usage: `${ exampleUsage } --slug=example-site -- wp shell`, + description: 'Run the WP-CLI command "wp shell" against a local environment to open an interactive PHP console.', }, ]; -command( { wildcardCommand: true } ) - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( 'force', 'Disable validations before task execution', undefined, processBooleanOption ) - .option( 'quiet', 'Suppress output', undefined, processBooleanOption ) +command( { + wildcardCommand: true, + usage, +} ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( 'force', 'Skip validation for a local environment to be in a running state.', undefined, processBooleanOption ) + .option( 'quiet', 'Suppress informational messages.', undefined, processBooleanOption ) .examples( examples ) .argv( process.argv, async ( unmatchedArgs, opt ) => { const slug = await getEnvironmentName( opt ); @@ -49,7 +55,7 @@ command( { wildcardCommand: true } ) const argSplitterFound = argSplitterIx > -1; if ( unmatchedArgs.length > 0 && ! argSplitterFound ) { throw new Error( - 'Please provide "--" argument to separate arguments for "vip" and command to be executed (see "--help" for examples)' + 'A double dash ("--") must separate the arguments of "vip" from those of the "wp" command. Run "vip dev-env exec --help" for examples.' ); } @@ -62,7 +68,7 @@ command( { wildcardCommand: true } ) if ( ! opt.force ) { const isUp = await isEnvUp( lando, getEnvironmentPath( slug ) ); if ( ! isUp ) { - throw new UserError( 'Environment needs to be started before running a command' ); + throw new UserError( 'A WP-CLI command can only be executed on a running local environment.' ); } } diff --git a/src/bin/vip-dev-env-import-media.js b/src/bin/vip-dev-env-import-media.js index 933145617..fa8c9e0e8 100755 --- a/src/bin/vip-dev-env-import-media.js +++ b/src/bin/vip-dev-env-import-media.js @@ -11,24 +11,23 @@ import { import { importMediaPath } from '../lib/dev-environment/dev-environment-core'; import { trackEvent } from '../lib/tracker'; +const exampleUsage = 'vip dev-env import media'; +const usage = 'vip dev-env import media'; + const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import media path/to/wp-content/uploads`, - description: - 'Import contents of the given WP uploads folder file into the media library of the default dev environment', - }, - { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import media path/to/wp-content/uploads --slug=mysite`, + usage: `${ exampleUsage } /Users/example/Desktop/uploads --slug="example-site"`, description: - 'Import contents of the given WP uploads folder file into the media library of a dev environment named `mysite`', + 'Import the contents of the "uploads" directory from a path on the user\'s local machine to the "/wp-content/uploads" directory of the local environment named "example-site".', }, ]; command( { requiredArgs: 1, + usage, } ) .examples( examples ) - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) .argv( process.argv, async ( unmatchedArgs, opt ) => { const [ filePath ] = unmatchedArgs; const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-import-sql.js b/src/bin/vip-dev-env-import-sql.js index c4215c8b1..2db520ca1 100755 --- a/src/bin/vip-dev-env-import-sql.js +++ b/src/bin/vip-dev-env-import-sql.js @@ -2,7 +2,6 @@ import { DevEnvImportSQLCommand } from '../commands/dev-env-import-sql'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, handleCLIException, @@ -11,36 +10,46 @@ import { } from '../lib/dev-environment/dev-environment-cli'; import { makeCommandTracker } from '../lib/tracker'; +const exampleUsage = 'vip dev-env import sql'; +const usage = 'vip dev-env import sql'; + const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import sql some-wp-db-file.sql`, - description: 'Import the contents of a WordPress database from an SQL file', + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --slug="example-site"`, + description: 'Import the SQL file named "file.sql" from a path on the user\'s local machine to a running local environment named "example-site".', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import sql wordpress.sql --slug=my_site`, - description: 'Import the contents of a WordPress database from an SQL file into `my_site`', + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, + description: + 'Search for the string "example-site.com" in the SQL file and replace it with "example-site.vipdev.lndo.site" during the import.`', + }, + { + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --skip-reindex --slug="example-site"`, + description: + 'Import the SQL file to a local environment with Elasticsearch enabled, but do not reindex after the import is completed.`', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import sql wordpress.sql --search-replace="testsite.com,test-site.go-vip.net"`, + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --in-place`, description: - 'Import the contents of a WordPress database from an SQL file and replace the occurrences of `testsite.com` with `test-site.go-vip.net`', + 'Run a search and replace during the import and also save the results of the search and replace operation to the original SQL file ("file.sql").', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import sql wordpress.sql --search-replace="testsite.com,test-site.go-vip.net" --in-place`, + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, description: - 'Import the contents of a WordPress database from an SQL file and replace the occurrences of `testsite.com` with `test-site.go-vip.net` in place (modifies the original SQL file)', + 'Search and replace 2 pairs of strings during the import of the SQL file to a local multisite environment.', }, ]; command( { requiredArgs: 1, + usage, } ) - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( [ 'r', 'search-replace' ], 'Perform Search and Replace on the specified SQL file' ) - .option( 'in-place', 'Search and Replace explicitly on the given input file' ) - .option( 'skip-validate', 'Do not perform file validation' ) - .option( [ 'k', 'skip-reindex' ], 'Do not reindex data in Elasticsearch after import' ) - .option( 'quiet', 'Suppress prompts and informational messages' ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( [ 'r', 'search-replace' ], 'Search for a string in the SQL file and replace it with a new string.' ) + .option( 'in-place', 'Save the results of a search and replace operation to the original SQL file.' ) + .option( 'skip-validate', 'Skip file validation.' ) + .option( [ 'k', 'skip-reindex' ], 'Skip Elasticsearch reindex after import.' ) + .option( 'quiet', 'Skip confirmation and suppress informational messages.' ) .examples( examples ) .argv( process.argv, async ( unmatchedArgs, opt ) => { const [ fileName ] = unmatchedArgs; diff --git a/src/bin/vip-dev-env-import.js b/src/bin/vip-dev-env-import.js index bb1c63ac8..b193b7001 100755 --- a/src/bin/vip-dev-env-import.js +++ b/src/bin/vip-dev-env-import.js @@ -1,28 +1,30 @@ #!/usr/bin/env node import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; + +const exampleUsage = 'vip dev-env import'; +const usage = 'vip dev-env import'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import sql file.sql`, - description: 'Import the given SQL file to your site', + usage: `${ exampleUsage } sql /Users/example/Downloads/file.sql`, + description: 'Import the SQL file named "file.sql" from a path on the user\'s local machine to a running local environment.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } import media path/to/wp-content/uploads`, + usage: `${ exampleUsage } media /Users/example/Desktop/uploads`, description: - 'Import contents of the given WP uploads folder file into the media library of the default dev environment', + 'Import the contents of the "uploads" directory from a path on the user\'s local machine to the "/wp-content/uploads" directory of a running local environment.', }, ]; command( { requiredArgs: 1, + usage, } ) .examples( examples ) - .command( 'sql', 'Import SQL to your dev-env database from a file' ) + .command( 'sql', 'Import a SQL file to a running local environment.' ) .command( 'media', - 'Import media files to the dev environment of your application from a compressed web archive. ' + - 'This command will copy the contents of a folder to the `uploads` folder of the target dev environment.' + 'Import media files to a running local environment.' ) .argv( process.argv ); diff --git a/src/bin/vip-dev-env-info.js b/src/bin/vip-dev-env-info.js index fbd74c1e2..4a136a9b3 100755 --- a/src/bin/vip-dev-env-info.js +++ b/src/bin/vip-dev-env-info.js @@ -3,7 +3,6 @@ import debugLib from 'debug'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, getEnvironmentName, @@ -19,22 +18,30 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env info'; +const usage = 'vip dev-env info'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } info --all`, - description: 'Return information about all local dev environments', + usage: `${ exampleUsage } --slug=example-site`, + description: 'Retrieve basic information about the local environment named "example-site".', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } info --slug=my_site`, - description: 'Return information about a local dev environment named "my_site"', + usage: `${ exampleUsage } --slug=example-site --extended`, + description: 'Retrieve a larger amount of information about the local environment named "example-site".', + }, + { + usage: `${ exampleUsage } --all`, + description: 'Retrieve basic information about all local environments.', }, ]; -command() - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( 'all', 'Show Info for all local dev environments' ) - .option( 'extended', 'Show extended information about the dev environment' ) +command( { + usage, +}) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( 'all', 'Retrieve information about all local environments.' ) + .option( 'extended', 'Retrieve a larger amount of information.' ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { let trackingInfo; diff --git a/src/bin/vip-dev-env-list.js b/src/bin/vip-dev-env-list.js index b6c590947..a19c7871e 100755 --- a/src/bin/vip-dev-env-list.js +++ b/src/bin/vip-dev-env-list.js @@ -1,7 +1,6 @@ #!/usr/bin/env node import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { handleCLIException, validateDependencies, @@ -10,14 +9,19 @@ import { printAllEnvironmentsInfo } from '../lib/dev-environment/dev-environment import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; +const exampleUsage = 'vip dev-env list'; +const usage = 'vip dev-env list'; + const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } list`, - description: 'Return information about all local dev environments', + usage: `${ exampleUsage } list`, + description: 'Retrieve basic information about all local environments.', }, ]; -command() +command( { + usage, +}) .examples( examples ) .argv( process.argv, async () => { const lando = await bootstrapLando(); diff --git a/src/bin/vip-dev-env-logs.js b/src/bin/vip-dev-env-logs.js index 696f9e5f8..1e9753631 100755 --- a/src/bin/vip-dev-env-logs.js +++ b/src/bin/vip-dev-env-logs.js @@ -3,7 +3,6 @@ import debugLib from 'debug'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, getEnvironmentName, @@ -16,31 +15,32 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env logs'; +const usage = 'vip dev-env logs'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } logs --slug=my_site`, - description: 'Return all logs from a local dev environment named "my_site"', + usage: `${ exampleUsage } --slug=example-site`, + description: 'Retrieve logs for all running services of the local environment named "example-site".', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } logs --slug=my_site --service=elasticsearch`, + usage: `${ exampleUsage } --service=elasticsearch --slug=example-site`, description: - 'Return logs from the "elasticsearch" service from a local dev environment named "my_site"', + 'Retrieve logs only for the "elasticsearch" service of the local environment named "example-site".', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } logs --slug=my_site --service=elasticsearch -f`, + usage: `${ exampleUsage } --service=database --follow --slug=example-site`, description: - 'Follow logs from the "elasticsearch" service from a local dev environment named "my_site"', + 'Retrieve and continually output logs for the "database" service of the local environment named "example-site".', }, ]; -command() - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( [ 'f', 'follow' ], 'Follow logs for a specific service in local dev environment' ) - .option( - 'service', - 'Show logs for a specific service in local dev environment. Defaults to all if none passed in.' - ) +command( { + usage, +} ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( [ 'f', 'follow' ], 'Continually output logs as they are generated.' ) + .option( 'service', 'Restrict to a single service.' ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-purge.js b/src/bin/vip-dev-env-purge.js index d2872546b..433bc9c92 100755 --- a/src/bin/vip-dev-env-purge.js +++ b/src/bin/vip-dev-env-purge.js @@ -10,7 +10,6 @@ import debugLib from 'debug'; * Internal dependencies */ import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, handleCLIException, @@ -25,21 +24,30 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env purge'; +const usage = 'vip dev-env purge'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } purge`, - description: 'Destroys all local dev environments', + usage: `${ exampleUsage }`, + description: 'Destroy all local environments.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } purge --force`, - description: 'Destroys all local dev environments without prompting', + usage: `${ exampleUsage } --force`, + description: 'Destroy all local environments without requiring confirmation from the user.', + }, + { + usage: `${ exampleUsage } --soft`, + description: 'Remove the Docker containers and volumes of all local environments but preserve their configuration files.\n' + + ' * Preserving the configuration files allows the local environments to be restarted; new Docker containers and volumes will be generated.', }, ]; -command() - .option( 'soft', 'Keep config files needed to start an environment intact' ) - .option( 'force', 'Removes prompt that verifies if user wants to destroy all environments' ) +command( { + usage, +}) + .option( 'soft', 'Preserve an environment\’s configuration files; allows an environment to be regenerated with the start command.' ) + .option( 'force', 'Skip confirmation.' ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { debug( 'Args: ', arg, 'Options: ', opt ); @@ -54,7 +62,7 @@ command() if ( ! opt.force ) { const purge = await promptForBoolean( - 'Are you sure you want to purge ALL existing dev environments?', + 'Are you sure you want to purge ALL existing local environments?', true ); @@ -74,7 +82,7 @@ command() // eslint-disable-next-line no-await-in-loop await destroyEnvironment( lando, slug, removeFiles ); - const message = chalk.green( '✓' ) + ' Environment destroyed.\n'; + const message = chalk.green( '✓' ) + ' Environments purged.\n'; console.log( message ); } catch ( error ) { const trackingInfoChild = getEnvTrackingInfo( slug ); diff --git a/src/bin/vip-dev-env-shell.js b/src/bin/vip-dev-env-shell.js index 10e736fdb..593e0492b 100755 --- a/src/bin/vip-dev-env-shell.js +++ b/src/bin/vip-dev-env-shell.js @@ -3,7 +3,6 @@ import debugLib from 'debug'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, validateDependencies, @@ -16,6 +15,8 @@ import { bootstrapLando, landoShell } from '../lib/dev-environment/dev-environme import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env shell'; +const usage = 'vip dev-env shell'; const userMap = { nginx: 'www-data', @@ -30,21 +31,22 @@ const userMap = { const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } shell`, - description: 'Spawns a shell in the dev environment', + usage: `${ exampleUsage } --slug=example-site`, + description: 'Create and enter an SSH command shell for the local environment named "example-site".', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } shell -r`, - description: 'Spawns a shell in the dev environment under root user', + usage: `${ exampleUsage } --root --slug=example-site`, + description: 'Create and enter an SSH command shell for the local environment with root privileges.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } shell -- ls -lha`, - description: 'Runs `ls -lha` command in the shell in the dev environment', + usage: `${ exampleUsage } --slug=example-site -- ls -lha`, + description: 'Create an SSH command shell for the local environment and run the command "ls -lha".\n' + + ' * A double dash ("--") must separate the arguments of "vip" from those of the "wp" command.', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } shell -S database -- ls -lha`, + usage: `${ exampleUsage } --service=database --slug=example-site -- ls -lha`, description: - 'Runs `ls -lha` command in the shell of the database service in the dev environment', + 'Create an SSH command shell for the database service of the local environment and run the command "ls -lha".', }, ]; @@ -56,7 +58,7 @@ function getCommand( args ) { const splitterIdx = process.argv.findIndex( argument => '--' === argument ); if ( args.length > 0 && splitterIdx === -1 ) { throw new Error( - 'Please provide "--" argument to separate arguments for "vip" and command to be executed (see "--help" for examples)' + 'A double dash ("--") must separate the arguments of "vip" from those of the command to be executed. Run "vip dev-env shell --help" for examples.' ); } @@ -69,10 +71,13 @@ function getCommand( args ) { return cmd; } -command( { wildcardCommand: true } ) - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( 'root', 'Spawn a root shell' ) - .option( 'service', 'Spawn a shell in a specific service (php if omitted)' ) +command( { + wildcardCommand: true, + usage, +} ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( 'root', 'Create with root privileges.' ) + .option( 'service', 'Restrict to a single service. Default is "php".' ) .examples( examples ) .argv( process.argv, async ( args, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-start.js b/src/bin/vip-dev-env-start.js index 3ed12493c..8a627ec29 100755 --- a/src/bin/vip-dev-env-start.js +++ b/src/bin/vip-dev-env-start.js @@ -3,7 +3,6 @@ import debugLib from 'debug'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, validateDependencies, @@ -17,27 +16,41 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env start'; +const usage = 'vip dev-env start'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } start`, - description: 'Starts a local dev environment', + usage: `${ exampleUsage } --slug=example-site`, + description: 'Start a local environment named "example-site".', }, { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } start --vscode`, + usage: `${ exampleUsage } --skip-wp-versions-check --slug=example-site`, description: - 'Start a local environment and generate a Workspace file for developing in Visual Studio Code', + 'Skip the prompt to upgrade WordPress to the latest release version and start a local environment with WordPress v6.4 configured.', + }, + { + usage: `${ exampleUsage } --skip-rebuild --slug=example-site`, + description: + 'Start only the services of a local environment that are not currently in a running state.', + }, + { + usage: `${ exampleUsage } --vscode --slug=example-site`, + description: + 'Start a local environment and generate a Workspace file for developing in Visual Studio Code.', }, ]; -command() - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( 'skip-rebuild', 'Only start stopped services' ) +command( { + usage, +}) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( 'skip-rebuild', 'Only start services that are not in a running state.' ) .option( [ 'w', 'skip-wp-versions-check' ], - 'Skip prompt to update WordPress version if not on latest' + 'Skip the prompt to update WordPress that occurs unless the last major release version is configured.' ) - .option( 'vscode', 'Generate a Visual Studio Code Workspace file' ) + .option( 'vscode', 'Generate a Visual Studio Code Workspace file.' ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-stop.js b/src/bin/vip-dev-env-stop.js index 6e97bde59..04df29982 100755 --- a/src/bin/vip-dev-env-stop.js +++ b/src/bin/vip-dev-env-stop.js @@ -4,7 +4,6 @@ import chalk from 'chalk'; import debugLib from 'debug'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvTrackingInfo, getEnvironmentName, @@ -17,16 +16,20 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env stop'; +const usage = 'vip dev-env stop'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } stop`, - description: 'Stops a local dev environment', + usage: `${ exampleUsage } --slug=example-site`, + description: 'Stop a local environment named "example-site".', }, ]; -command() - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) +command( { + usage, +}) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-sync-sql.js b/src/bin/vip-dev-env-sync-sql.js index c7d17a9b8..b9f278c10 100755 --- a/src/bin/vip-dev-env-sync-sql.js +++ b/src/bin/vip-dev-env-sync-sql.js @@ -2,7 +2,6 @@ import { DevEnvSyncSQLCommand } from '../commands/dev-env-sync-sql'; import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvironmentName, processBooleanOption, @@ -13,10 +12,12 @@ import { bootstrapLando, isEnvUp } from '../lib/dev-environment/dev-environment- import { makeCommandTracker } from '../lib/tracker'; import UserError from '../lib/user-error'; +const usage = 'vip dev-env sync sql'; + const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } sync sql @my-test.develop --slug=my_site`, - description: "Syncs with the `my-test` site's `develop` environment database into `my_site`", + usage: `vip @example-app.develop dev-env sync sql --slug=example-site`, + description: 'Sync the database of the develop environment in the "example-app" application to a local environment named "example-site".', }, ]; @@ -49,9 +50,10 @@ command( { envContext: true, requiredArgs: 0, module: 'dev-env-sync-sql', + usage, } ) - .option( 'slug', 'Custom name of the dev environment', undefined, processSlug ) - .option( 'force', 'Disable validations before running sync', undefined, processBooleanOption ) + .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( 'force', 'Skip validations.', undefined, processBooleanOption ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { const { app, env, ...optRest } = opt; diff --git a/src/bin/vip-dev-env-sync.js b/src/bin/vip-dev-env-sync.js index 4a4b6a53a..26d0754d0 100755 --- a/src/bin/vip-dev-env-sync.js +++ b/src/bin/vip-dev-env-sync.js @@ -1,9 +1,18 @@ #!/usr/bin/env node import command from '../lib/cli/command'; +const usage = 'vip dev-env sync'; + +const examples = [ + { + usage: `vip @example-app.develop dev-env sync sql --slug=example-site`, + description: 'Sync the database of the develop environment in the "example-app" application to a local environment named "example-site".', + }, +]; command( { requiredArgs: 1, + usage, } ) - .command( 'sql', 'Sync local database with a production environment' ) + .command( 'sql', 'Sync the database of a VIP Platform environment to a local environment.' ) .argv( process.argv ); diff --git a/src/bin/vip-dev-env-update.js b/src/bin/vip-dev-env-update.js index 5bcf2098c..b502d22c8 100755 --- a/src/bin/vip-dev-env-update.js +++ b/src/bin/vip-dev-env-update.js @@ -32,16 +32,23 @@ import { bootstrapLando } from '../lib/dev-environment/dev-environment-lando'; import { trackEvent } from '../lib/tracker'; const debug = debugLib( '@automattic/vip:bin:dev-environment' ); +const exampleUsage = 'vip dev-env update'; +const usage = 'vip dev-env update'; const examples = [ { - usage: `${ DEV_ENVIRONMENT_FULL_COMMAND } update`, - description: 'Retriggers setup wizard in order to change environment configuration', + usage: `${ exampleUsage } --slug=example-site`, + description: 'Update the settings of a local environment named "example-site" in the setup wizard.', + }, + { + usage: `${ exampleUsage } --php=8.2 --app-code=/Users/example/Desktop/example-app-code --slug=example-site`, + description: 'Update the version of PHP running on the local environment to 8.2 and load application code from a path on the user\'s local machine.\n' + + ' * Options that are set in the command will be skipped in the setup wizard.', }, ]; -const cmd = command().option( - 'slug', - 'Custom name of the dev environment', +const cmd = command( { + usage, +} ).option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ); diff --git a/src/bin/vip-dev-env.js b/src/bin/vip-dev-env.js index fd65bd36f..e5b957968 100755 --- a/src/bin/vip-dev-env.js +++ b/src/bin/vip-dev-env.js @@ -5,20 +5,17 @@ import command from '../lib/cli/command'; command( { requiredArgs: 0, } ) - .command( 'create', 'Create a new local dev environment' ) - .command( 'update', 'Update an already created local dev environment' ) - .command( 'start', 'Start a local dev environment' ) - .command( 'stop', 'Stop a local dev environment' ) - .command( - 'destroy', - 'Remove containers, networks, volumes and configuration files of a local dev environment' - ) - .command( 'info', 'Provides basic info about one or multiple local dev environments' ) - .command( 'list', 'Provides basic info about all local dev environments' ) - .command( 'exec', 'Execute a WP-CLI command in local dev environment' ) - .command( 'import', 'Import data into a local WordPress environment' ) - .command( 'shell', 'Spawns a shell in a dev environment' ) - .command( 'logs', 'View logs from a local WordPress environment' ) - .command( 'sync', 'Pull data from production to local development environment' ) - .command( 'purge', 'Destroy all existing environments' ) + .command( 'create', 'Create a new local environment.' ) + .command( 'update', 'Update the settings of a local environment.' ) + .command( 'start', 'Start a local environment.' ) + .command( 'stop', 'Stop a local environment.' ) + .command( 'destroy', 'Remove a local environment.' ) + .command( 'info', 'Retrieve information about a local environment.' ) + .command( 'list', 'Retrieve information about all local environments.' ) + .command( 'exec', 'Run a WP-CLI command against a local environment.' ) + .command( 'import', 'Import media or database files to a local environment.' ) + .command( 'shell', 'Create a shell and run commands against a local environment.' ) + .command( 'logs', 'Retrieve logs for a local environment.' ) + .command( 'sync', 'Sync the database of a VIP Platform environment to a local environment.' ) + .command( 'purge', 'Remove all local environments.' ) .argv( process.argv ); diff --git a/src/bin/vip.js b/src/bin/vip.js index 7b19a6b75..0312d6bf7 100755 --- a/src/bin/vip.js +++ b/src/bin/vip.js @@ -30,7 +30,7 @@ const runCmd = async function () { .command( 'backup', 'Generate a backup of an environment.' ) .command( 'cache', 'Manage page cache for your VIP applications' ) .command( 'config', 'Manage environment configurations.' ) - .command( 'dev-env', 'Use local dev-environment' ) + .command( 'dev-env', 'Create and manage VIP Local Development Environments.' ) .command( 'export', 'Export a copy of data associated with an environment.' ) .command( 'import', 'Import media or SQL files into your VIP applications' ) .command( 'logs', 'Get logs from your VIP applications' ) From cc94671e530f39735e172e7c057408e93dea256b Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Fri, 17 May 2024 16:39:55 -0700 Subject: [PATCH 2/5] Second draft for command descriptions and examples --- src/bin/vip-dev-env-create.js | 10 +++++----- src/bin/vip-dev-env-destroy.js | 2 +- src/bin/vip-dev-env-exec.js | 2 +- src/bin/vip-dev-env-import-sql.js | 18 +++++++++--------- src/bin/vip-dev-env-list.js | 2 +- src/bin/vip-dev-env-purge.js | 2 +- src/bin/vip-dev-env-shell.js | 8 ++++---- src/bin/vip-dev-env-start.js | 4 ++-- src/bin/vip-dev-env-sync.js | 1 + src/bin/vip-dev-env-update.js | 12 ++++++++---- 10 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/bin/vip-dev-env-create.js b/src/bin/vip-dev-env-create.js index d74bcee28..49b1e61ea 100755 --- a/src/bin/vip-dev-env-create.js +++ b/src/bin/vip-dev-env-create.js @@ -40,23 +40,23 @@ const examples = [ { usage: exampleUsage, description: 'Create a new VIP Local Development Environment.\n' + - ' * If a custom name is not assigned with "--slug" the environment will be named "vip-local" by default.', + ' * The environment will be named "vip-local" by default if a custom name is not assigned with "--slug" .', }, { usage: `${ exampleUsage } --slug=example-site`, description: - 'Create a new local environment with the unique slug "example-site".\n' + - ' * Unique slugs allow multiple local environments to exist simultaneously.', + 'Create a new local environment with the unique name "example-site".\n' + + ' * Unique names allow multiple local environments to exist simultaneously.', }, { usage: `${ exampleUsage } --slug=example-site --multisite=y --php=8.2 --wordpress=6.4`, description: 'Create a new local environment configured as a multisite running PHP 8.2 and WordPress version 6.4.\n' + - ' * Options that are set in the command will be skipped in the setup wizard.', + ' * Options that are set in the `create` command will be skipped in the setup wizard.', }, { usage: `vip @example-app.production dev-env create --slug=example-site --app-code=/Users/example/Desktop/example-repo`, - description: 'Create a new local environment with settings based on the production environment of the "example-app" application and load the locally git-cloned application repository.', + description: 'Create a new local environment with settings based on the production environment of the "example-app" application and load the locally git-cloned application repository "example-repo".', }, ]; diff --git a/src/bin/vip-dev-env-destroy.js b/src/bin/vip-dev-env-destroy.js index 48067da7d..03f7a0219 100755 --- a/src/bin/vip-dev-env-destroy.js +++ b/src/bin/vip-dev-env-destroy.js @@ -27,7 +27,7 @@ const examples = [ { usage: `${ exampleUsage } --soft --slug=example-site`, description: 'Remove the Docker containers and volumes of a local environment named "example-site" but preserve the configuration files.\n' + - ' * The configuration files allow the local environment to be restarted with new Docker containers and volumes.', + ' * The preserved configuration files allow the local environment to be restarted with new Docker containers and volumes.', }, ]; diff --git a/src/bin/vip-dev-env-exec.js b/src/bin/vip-dev-env-exec.js index 5686cb3b4..c5d0ad581 100755 --- a/src/bin/vip-dev-env-exec.js +++ b/src/bin/vip-dev-env-exec.js @@ -25,7 +25,7 @@ const examples = [ }, { usage: `${ exampleUsage } --slug=example-site -- wp user list --url=example.example-site.vipdev.lndo.site`, - description: 'Target the WP-CLI command against the network site "example.example-site.vipdev.lndo.site" of a local multisite environment.`', + description: 'Target the WP-CLI command against the network site "example.example-site.vipdev.lndo.site" of a local multisite environment.', }, { usage: `${ exampleUsage } --slug=example-site -- wp shell`, diff --git a/src/bin/vip-dev-env-import-sql.js b/src/bin/vip-dev-env-import-sql.js index 2db520ca1..4fdf2708d 100755 --- a/src/bin/vip-dev-env-import-sql.js +++ b/src/bin/vip-dev-env-import-sql.js @@ -15,26 +15,26 @@ const usage = 'vip dev-env import sql'; const examples = [ { - usage: `${ exampleUsage } /Users/example/Downloads/file.sql --slug="example-site"`, + usage: '${ exampleUsage } /Users/example/Downloads/file.sql --slug="example-site"', description: 'Import the SQL file named "file.sql" from a path on the user\'s local machine to a running local environment named "example-site".', }, { - usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, + usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"', description: - 'Search for the string "example-site.com" in the SQL file and replace it with "example-site.vipdev.lndo.site" during the import.`', + 'Search for the string "example-site.com" in the SQL file and replace it with "example-site.vipdev.lndo.site" during the import.', }, { - usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --skip-reindex --slug="example-site"`, + usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --skip-reindex --slug="example-site"', description: - 'Import the SQL file to a local environment with Elasticsearch enabled, but do not reindex after the import is completed.`', + 'Import the SQL file to a local environment with Elasticsearch enabled, and do not reindex after the import is completed.', }, { - usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --in-place`, + usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --in-place', description: - 'Run a search and replace during the import and also save the results of the search and replace operation to the original SQL file ("file.sql").', + 'Perform the search and replace operation on the local SQL file ("file.sql"), save the changes, and import the updated file to the local environment.', }, { - usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, + usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"', description: 'Search and replace 2 pairs of strings during the import of the SQL file to a local multisite environment.', }, @@ -46,7 +46,7 @@ command( { } ) .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) .option( [ 'r', 'search-replace' ], 'Search for a string in the SQL file and replace it with a new string.' ) - .option( 'in-place', 'Save the results of a search and replace operation to the original SQL file.' ) + .option( 'in-place', 'Perform a search and replace operation on the local SQL file and save the results.' ) .option( 'skip-validate', 'Skip file validation.' ) .option( [ 'k', 'skip-reindex' ], 'Skip Elasticsearch reindex after import.' ) .option( 'quiet', 'Skip confirmation and suppress informational messages.' ) diff --git a/src/bin/vip-dev-env-list.js b/src/bin/vip-dev-env-list.js index a19c7871e..0d03e0a34 100755 --- a/src/bin/vip-dev-env-list.js +++ b/src/bin/vip-dev-env-list.js @@ -14,7 +14,7 @@ const usage = 'vip dev-env list'; const examples = [ { - usage: `${ exampleUsage } list`, + usage: '${ exampleUsage }', description: 'Retrieve basic information about all local environments.', }, ]; diff --git a/src/bin/vip-dev-env-purge.js b/src/bin/vip-dev-env-purge.js index 433bc9c92..17012fbe0 100755 --- a/src/bin/vip-dev-env-purge.js +++ b/src/bin/vip-dev-env-purge.js @@ -39,7 +39,7 @@ const examples = [ { usage: `${ exampleUsage } --soft`, description: 'Remove the Docker containers and volumes of all local environments but preserve their configuration files.\n' + - ' * Preserving the configuration files allows the local environments to be restarted; new Docker containers and volumes will be generated.', + ' * Preserving the configuration files allows the local environments to be regenerated; new Docker containers and volumes will be created.', }, ]; diff --git a/src/bin/vip-dev-env-shell.js b/src/bin/vip-dev-env-shell.js index 593e0492b..132b836a2 100755 --- a/src/bin/vip-dev-env-shell.js +++ b/src/bin/vip-dev-env-shell.js @@ -32,16 +32,16 @@ const userMap = { const examples = [ { usage: `${ exampleUsage } --slug=example-site`, - description: 'Create and enter an SSH command shell for the local environment named "example-site".', + description: 'Create and enter an SSH command shell for the PHP service (default) of the local environment named "example-site".', }, { usage: `${ exampleUsage } --root --slug=example-site`, - description: 'Create and enter an SSH command shell for the local environment with root privileges.', + description: 'Create and enter an SSH command shell with root privileges for the local environment.', }, { usage: `${ exampleUsage } --slug=example-site -- ls -lha`, description: 'Create an SSH command shell for the local environment and run the command "ls -lha".\n' + - ' * A double dash ("--") must separate the arguments of "vip" from those of the "wp" command.', + ' * A double dash ("--") must separate the arguments of "vip" from those of the command.', }, { usage: `${ exampleUsage } --service=database --slug=example-site -- ls -lha`, @@ -77,7 +77,7 @@ command( { } ) .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) .option( 'root', 'Create with root privileges.' ) - .option( 'service', 'Restrict to a single service. Default is "php".' ) + .option( 'service', 'Restrict to a single service.' ) .examples( examples ) .argv( process.argv, async ( args, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-start.js b/src/bin/vip-dev-env-start.js index 8a627ec29..0bb5db904 100755 --- a/src/bin/vip-dev-env-start.js +++ b/src/bin/vip-dev-env-start.js @@ -27,7 +27,7 @@ const examples = [ { usage: `${ exampleUsage } --skip-wp-versions-check --slug=example-site`, description: - 'Skip the prompt to upgrade WordPress to the latest release version and start a local environment with WordPress v6.4 configured.', + 'Skip the prompt to upgrade WordPress to the latest release version and start a local environment with the less recent version of WordPress currently configured.', }, { usage: `${ exampleUsage } --skip-rebuild --slug=example-site`, @@ -48,7 +48,7 @@ command( { .option( 'skip-rebuild', 'Only start services that are not in a running state.' ) .option( [ 'w', 'skip-wp-versions-check' ], - 'Skip the prompt to update WordPress that occurs unless the last major release version is configured.' + 'Skip the prompt to update WordPress; occurs if the last major release version is not configured.' ) .option( 'vscode', 'Generate a Visual Studio Code Workspace file.' ) .examples( examples ) diff --git a/src/bin/vip-dev-env-sync.js b/src/bin/vip-dev-env-sync.js index 26d0754d0..74515ee39 100755 --- a/src/bin/vip-dev-env-sync.js +++ b/src/bin/vip-dev-env-sync.js @@ -14,5 +14,6 @@ command( { requiredArgs: 1, usage, } ) + .examples( examples ) .command( 'sql', 'Sync the database of a VIP Platform environment to a local environment.' ) .argv( process.argv ); diff --git a/src/bin/vip-dev-env-update.js b/src/bin/vip-dev-env-update.js index b502d22c8..38d663024 100755 --- a/src/bin/vip-dev-env-update.js +++ b/src/bin/vip-dev-env-update.js @@ -38,12 +38,16 @@ const usage = 'vip dev-env update'; const examples = [ { usage: `${ exampleUsage } --slug=example-site`, - description: 'Update the settings of a local environment named "example-site" in the setup wizard.', + description: 'Update or confirm all settings for the local environment named "example-site" in the setup wizard.', }, { - usage: `${ exampleUsage } --php=8.2 --app-code=/Users/example/Desktop/example-app-code --slug=example-site`, - description: 'Update the version of PHP running on the local environment to 8.2 and load application code from a path on the user\'s local machine.\n' + - ' * Options that are set in the command will be skipped in the setup wizard.', + usage: `${ exampleUsage } --php=8.2 --slug=example-site`, + description: 'Update the PHP version to 8.2 in the `update` command then enter the setup wizard to update or confirm all other settings.\n' + + ' * Configuration options that are set in the `update` command will be skipped in the setup wizard.', + }, + { + usage: `${ exampleUsage } --app-code=/Users/example/Desktop/example-app-code --slug=example-site`, + description: 'Update application code to load from a path on the user\'s local machine for the local environment.', }, ]; const cmd = command( { From b826d520d197c58b4b1f40136d644055adc94bad Mon Sep 17 00:00:00 2001 From: Yoli Hodde Date: Fri, 17 May 2024 16:46:14 -0700 Subject: [PATCH 3/5] Prettier linting --- src/bin/vip-dev-env-create.js | 22 +++++++++++++++----- src/bin/vip-dev-env-destroy.js | 22 ++++++++++++++------ src/bin/vip-dev-env-exec.js | 31 +++++++++++++++++++++-------- src/bin/vip-dev-env-import-media.js | 8 ++++++-- src/bin/vip-dev-env-import-sql.js | 31 ++++++++++++++++++++--------- src/bin/vip-dev-env-import.js | 8 +++----- src/bin/vip-dev-env-info.js | 12 ++++++++--- src/bin/vip-dev-env-list.js | 4 ++-- src/bin/vip-dev-env-logs.js | 10 ++++++++-- src/bin/vip-dev-env-purge.js | 12 +++++++---- src/bin/vip-dev-env-shell.js | 20 +++++++++++++------ src/bin/vip-dev-env-start.js | 9 +++++++-- src/bin/vip-dev-env-stop.js | 9 +++++++-- src/bin/vip-dev-env-sync-sql.js | 10 ++++++++-- src/bin/vip-dev-env-sync.js | 3 ++- src/bin/vip-dev-env-update.js | 16 +++++++++------ 16 files changed, 162 insertions(+), 65 deletions(-) diff --git a/src/bin/vip-dev-env-create.js b/src/bin/vip-dev-env-create.js index 49b1e61ea..627bdf2ff 100755 --- a/src/bin/vip-dev-env-create.js +++ b/src/bin/vip-dev-env-create.js @@ -39,8 +39,9 @@ const usage = 'vip dev-env create'; const examples = [ { usage: exampleUsage, - description: 'Create a new VIP Local Development Environment.\n' + - ' * The environment will be named "vip-local" by default if a custom name is not assigned with "--slug" .', + description: + 'Create a new VIP Local Development Environment.\n' + + ' * The environment will be named "vip-local" by default if a custom name is not assigned with "--slug" .', }, { usage: `${ exampleUsage } --slug=example-site`, @@ -56,16 +57,27 @@ const examples = [ }, { usage: `vip @example-app.production dev-env create --slug=example-site --app-code=/Users/example/Desktop/example-repo`, - description: 'Create a new local environment with settings based on the production environment of the "example-app" application and load the locally git-cloned application repository "example-repo".', + description: + 'Create a new local environment with settings based on the production environment of the "example-app" application and load the locally git-cloned application repository "example-repo".', }, ]; const cmd = command( { usage, } ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .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".', undefined, processStringOrBooleanOption ); + .option( + 'multisite', + 'Create environment as a multisite. Accepts "y" for a subdomain multisite, "subdirectory" (recommended) for a subdirectory multisite, or "false". Default is "y".', + undefined, + processStringOrBooleanOption + ); addDevEnvConfigurationOptions( cmd ); diff --git a/src/bin/vip-dev-env-destroy.js b/src/bin/vip-dev-env-destroy.js index 03f7a0219..818749e23 100755 --- a/src/bin/vip-dev-env-destroy.js +++ b/src/bin/vip-dev-env-destroy.js @@ -22,20 +22,30 @@ const usage = 'vip dev-env destroy'; const examples = [ { usage: `${ exampleUsage } --slug=example-site`, - description: 'Completely remove a local environment named "example-site" by removing all Docker containers, volumes, and configuration files.', + description: + 'Completely remove a local environment named "example-site" by removing all Docker containers, volumes, and configuration files.', }, { usage: `${ exampleUsage } --soft --slug=example-site`, - description: 'Remove the Docker containers and volumes of a local environment named "example-site" but preserve the configuration files.\n' + - ' * The preserved configuration files allow the local environment to be restarted with new Docker containers and volumes.', + description: + 'Remove the Docker containers and volumes of a local environment named "example-site" but preserve the configuration files.\n' + + ' * The preserved configuration files allow the local environment to be restarted with new Docker containers and volumes.', }, ]; -const cmd = command( { +command( { usage, } ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) - .option( 'soft', 'Preserve an environment\’s configuration files; allows an environment to be regenerated with the start command.' ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) + .option( + 'soft', + 'Preserve an environment’s configuration files; allows an environment to be regenerated with the start command.' + ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-exec.js b/src/bin/vip-dev-env-exec.js index c5d0ad581..87a3104df 100755 --- a/src/bin/vip-dev-env-exec.js +++ b/src/bin/vip-dev-env-exec.js @@ -20,25 +20,38 @@ const usage = 'vip dev-env exec'; const examples = [ { usage: `${ exampleUsage } --slug=example-site -- wp post list`, - description: 'Run a WP-CLI command against a local environment named "example-site".\n' + - ' * A double dash ("--") must separate the arguments of "vip" from those of the "wp" command.', + description: + 'Run a WP-CLI command against a local environment named "example-site".\n' + + ' * A double dash ("--") must separate the arguments of "vip" from those of the "wp" command.', }, { usage: `${ exampleUsage } --slug=example-site -- wp user list --url=example.example-site.vipdev.lndo.site`, - description: 'Target the WP-CLI command against the network site "example.example-site.vipdev.lndo.site" of a local multisite environment.', + description: + 'Target the WP-CLI command against the network site "example.example-site.vipdev.lndo.site" of a local multisite environment.', }, { usage: `${ exampleUsage } --slug=example-site -- wp shell`, - description: 'Run the WP-CLI command "wp shell" against a local environment to open an interactive PHP console.', + description: + 'Run the WP-CLI command "wp shell" against a local environment to open an interactive PHP console.', }, ]; -command( { +command( { wildcardCommand: true, usage, } ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) - .option( 'force', 'Skip validation for a local environment to be in a running state.', undefined, processBooleanOption ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) + .option( + 'force', + 'Skip validation for a local environment to be in a running state.', + undefined, + processBooleanOption + ) .option( 'quiet', 'Suppress informational messages.', undefined, processBooleanOption ) .examples( examples ) .argv( process.argv, async ( unmatchedArgs, opt ) => { @@ -68,7 +81,9 @@ command( { if ( ! opt.force ) { const isUp = await isEnvUp( lando, getEnvironmentPath( slug ) ); if ( ! isUp ) { - throw new UserError( 'A WP-CLI command can only be executed on a running local environment.' ); + throw new UserError( + 'A WP-CLI command can only be executed on a running local environment.' + ); } } diff --git a/src/bin/vip-dev-env-import-media.js b/src/bin/vip-dev-env-import-media.js index fa8c9e0e8..2e2f2ec78 100755 --- a/src/bin/vip-dev-env-import-media.js +++ b/src/bin/vip-dev-env-import-media.js @@ -1,7 +1,6 @@ #!/usr/bin/env node import command from '../lib/cli/command'; -import { DEV_ENVIRONMENT_FULL_COMMAND } from '../lib/constants/dev-environment'; import { getEnvironmentName, getEnvTrackingInfo, @@ -27,7 +26,12 @@ command( { usage, } ) .examples( examples ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .argv( process.argv, async ( unmatchedArgs, opt ) => { const [ filePath ] = unmatchedArgs; const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-import-sql.js b/src/bin/vip-dev-env-import-sql.js index 4fdf2708d..33b8a09fa 100755 --- a/src/bin/vip-dev-env-import-sql.js +++ b/src/bin/vip-dev-env-import-sql.js @@ -15,26 +15,28 @@ const usage = 'vip dev-env import sql'; const examples = [ { - usage: '${ exampleUsage } /Users/example/Downloads/file.sql --slug="example-site"', - description: 'Import the SQL file named "file.sql" from a path on the user\'s local machine to a running local environment named "example-site".', + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --slug="example-site"`, + description: + 'Import the SQL file named "file.sql" from a path on the user\'s local machine to a running local environment named "example-site".', }, { - usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"', + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, description: 'Search for the string "example-site.com" in the SQL file and replace it with "example-site.vipdev.lndo.site" during the import.', }, { - usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --skip-reindex --slug="example-site"', + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --skip-reindex --slug="example-site"`, description: 'Import the SQL file to a local environment with Elasticsearch enabled, and do not reindex after the import is completed.', }, { - usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --in-place', + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com,example-site.vipdev.lndo.site" --in-place`, description: 'Perform the search and replace operation on the local SQL file ("file.sql"), save the changes, and import the updated file to the local environment.', }, { - usage: '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"', + usage: + '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"', description: 'Search and replace 2 pairs of strings during the import of the SQL file to a local multisite environment.', }, @@ -44,9 +46,20 @@ command( { requiredArgs: 1, usage, } ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) - .option( [ 'r', 'search-replace' ], 'Search for a string in the SQL file and replace it with a new string.' ) - .option( 'in-place', 'Perform a search and replace operation on the local SQL file and save the results.' ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) + .option( + [ 'r', 'search-replace' ], + 'Search for a string in the SQL file and replace it with a new string.' + ) + .option( + 'in-place', + 'Perform a search and replace operation on the local SQL file and save the results.' + ) .option( 'skip-validate', 'Skip file validation.' ) .option( [ 'k', 'skip-reindex' ], 'Skip Elasticsearch reindex after import.' ) .option( 'quiet', 'Skip confirmation and suppress informational messages.' ) diff --git a/src/bin/vip-dev-env-import.js b/src/bin/vip-dev-env-import.js index b193b7001..5139194a4 100755 --- a/src/bin/vip-dev-env-import.js +++ b/src/bin/vip-dev-env-import.js @@ -8,7 +8,8 @@ const usage = 'vip dev-env import'; const examples = [ { usage: `${ exampleUsage } sql /Users/example/Downloads/file.sql`, - description: 'Import the SQL file named "file.sql" from a path on the user\'s local machine to a running local environment.', + description: + 'Import the SQL file named "file.sql" from a path on the user\'s local machine to a running local environment.', }, { usage: `${ exampleUsage } media /Users/example/Desktop/uploads`, @@ -23,8 +24,5 @@ command( { } ) .examples( examples ) .command( 'sql', 'Import a SQL file to a running local environment.' ) - .command( - 'media', - 'Import media files to a running local environment.' - ) + .command( 'media', 'Import media files to a running local environment.' ) .argv( process.argv ); diff --git a/src/bin/vip-dev-env-info.js b/src/bin/vip-dev-env-info.js index 4a136a9b3..45295e609 100755 --- a/src/bin/vip-dev-env-info.js +++ b/src/bin/vip-dev-env-info.js @@ -28,7 +28,8 @@ const examples = [ }, { usage: `${ exampleUsage } --slug=example-site --extended`, - description: 'Retrieve a larger amount of information about the local environment named "example-site".', + description: + 'Retrieve a larger amount of information about the local environment named "example-site".', }, { usage: `${ exampleUsage } --all`, @@ -38,8 +39,13 @@ const examples = [ command( { usage, -}) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) +} ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .option( 'all', 'Retrieve information about all local environments.' ) .option( 'extended', 'Retrieve a larger amount of information.' ) .examples( examples ) diff --git a/src/bin/vip-dev-env-list.js b/src/bin/vip-dev-env-list.js index 0d03e0a34..c062a9d31 100755 --- a/src/bin/vip-dev-env-list.js +++ b/src/bin/vip-dev-env-list.js @@ -14,14 +14,14 @@ const usage = 'vip dev-env list'; const examples = [ { - usage: '${ exampleUsage }', + usage: `${ exampleUsage }`, description: 'Retrieve basic information about all local environments.', }, ]; command( { usage, -}) +} ) .examples( examples ) .argv( process.argv, async () => { const lando = await bootstrapLando(); diff --git a/src/bin/vip-dev-env-logs.js b/src/bin/vip-dev-env-logs.js index 1e9753631..0efa84ab2 100755 --- a/src/bin/vip-dev-env-logs.js +++ b/src/bin/vip-dev-env-logs.js @@ -21,7 +21,8 @@ const usage = 'vip dev-env logs'; const examples = [ { usage: `${ exampleUsage } --slug=example-site`, - description: 'Retrieve logs for all running services of the local environment named "example-site".', + description: + 'Retrieve logs for all running services of the local environment named "example-site".', }, { usage: `${ exampleUsage } --service=elasticsearch --slug=example-site`, @@ -38,7 +39,12 @@ const examples = [ command( { usage, } ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .option( [ 'f', 'follow' ], 'Continually output logs as they are generated.' ) .option( 'service', 'Restrict to a single service.' ) .examples( examples ) diff --git a/src/bin/vip-dev-env-purge.js b/src/bin/vip-dev-env-purge.js index 17012fbe0..40fb87426 100755 --- a/src/bin/vip-dev-env-purge.js +++ b/src/bin/vip-dev-env-purge.js @@ -38,15 +38,19 @@ const examples = [ }, { usage: `${ exampleUsage } --soft`, - description: 'Remove the Docker containers and volumes of all local environments but preserve their configuration files.\n' + - ' * Preserving the configuration files allows the local environments to be regenerated; new Docker containers and volumes will be created.', + description: + 'Remove the Docker containers and volumes of all local environments but preserve their configuration files.\n' + + ' * Preserving the configuration files allows the local environments to be regenerated; new Docker containers and volumes will be created.', }, ]; command( { usage, -}) - .option( 'soft', 'Preserve an environment\’s configuration files; allows an environment to be regenerated with the start command.' ) +} ) + .option( + 'soft', + 'Preserve an environment’s configuration files; allows an environment to be regenerated with the start command.' + ) .option( 'force', 'Skip confirmation.' ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { diff --git a/src/bin/vip-dev-env-shell.js b/src/bin/vip-dev-env-shell.js index 132b836a2..16743362d 100755 --- a/src/bin/vip-dev-env-shell.js +++ b/src/bin/vip-dev-env-shell.js @@ -32,16 +32,19 @@ const userMap = { const examples = [ { usage: `${ exampleUsage } --slug=example-site`, - description: 'Create and enter an SSH command shell for the PHP service (default) of the local environment named "example-site".', + description: + 'Create and enter an SSH command shell for the PHP service (default) of the local environment named "example-site".', }, { usage: `${ exampleUsage } --root --slug=example-site`, - description: 'Create and enter an SSH command shell with root privileges for the local environment.', + description: + 'Create and enter an SSH command shell with root privileges for the local environment.', }, { usage: `${ exampleUsage } --slug=example-site -- ls -lha`, - description: 'Create an SSH command shell for the local environment and run the command "ls -lha".\n' + - ' * A double dash ("--") must separate the arguments of "vip" from those of the command.', + description: + 'Create an SSH command shell for the local environment and run the command "ls -lha".\n' + + ' * A double dash ("--") must separate the arguments of "vip" from those of the command.', }, { usage: `${ exampleUsage } --service=database --slug=example-site -- ls -lha`, @@ -71,11 +74,16 @@ function getCommand( args ) { return cmd; } -command( { +command( { wildcardCommand: true, usage, } ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .option( 'root', 'Create with root privileges.' ) .option( 'service', 'Restrict to a single service.' ) .examples( examples ) diff --git a/src/bin/vip-dev-env-start.js b/src/bin/vip-dev-env-start.js index 0bb5db904..daceb27dd 100755 --- a/src/bin/vip-dev-env-start.js +++ b/src/bin/vip-dev-env-start.js @@ -43,8 +43,13 @@ const examples = [ command( { usage, -}) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) +} ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .option( 'skip-rebuild', 'Only start services that are not in a running state.' ) .option( [ 'w', 'skip-wp-versions-check' ], diff --git a/src/bin/vip-dev-env-stop.js b/src/bin/vip-dev-env-stop.js index 04df29982..d99841487 100755 --- a/src/bin/vip-dev-env-stop.js +++ b/src/bin/vip-dev-env-stop.js @@ -28,8 +28,13 @@ const examples = [ command( { usage, -}) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) +} ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { const slug = await getEnvironmentName( opt ); diff --git a/src/bin/vip-dev-env-sync-sql.js b/src/bin/vip-dev-env-sync-sql.js index b9f278c10..0941b4bd4 100755 --- a/src/bin/vip-dev-env-sync-sql.js +++ b/src/bin/vip-dev-env-sync-sql.js @@ -17,7 +17,8 @@ const usage = 'vip dev-env sync sql'; const examples = [ { usage: `vip @example-app.develop dev-env sync sql --slug=example-site`, - description: 'Sync the database of the develop environment in the "example-app" application to a local environment named "example-site".', + description: + 'Sync the database of the develop environment in the "example-app" application to a local environment named "example-site".', }, ]; @@ -52,7 +53,12 @@ command( { module: 'dev-env-sync-sql', usage, } ) - .option( 'slug', 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ) + .option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', + undefined, + processSlug + ) .option( 'force', 'Skip validations.', undefined, processBooleanOption ) .examples( examples ) .argv( process.argv, async ( arg, opt ) => { diff --git a/src/bin/vip-dev-env-sync.js b/src/bin/vip-dev-env-sync.js index 74515ee39..215930b7d 100755 --- a/src/bin/vip-dev-env-sync.js +++ b/src/bin/vip-dev-env-sync.js @@ -6,7 +6,8 @@ const usage = 'vip dev-env sync'; const examples = [ { usage: `vip @example-app.develop dev-env sync sql --slug=example-site`, - description: 'Sync the database of the develop environment in the "example-app" application to a local environment named "example-site".', + description: + 'Sync the database of the develop environment in the "example-app" application to a local environment named "example-site".', }, ]; diff --git a/src/bin/vip-dev-env-update.js b/src/bin/vip-dev-env-update.js index 38d663024..980eee469 100755 --- a/src/bin/vip-dev-env-update.js +++ b/src/bin/vip-dev-env-update.js @@ -5,7 +5,6 @@ import debugLib from 'debug'; import command from '../lib/cli/command'; import { - DEV_ENVIRONMENT_FULL_COMMAND, DEV_ENVIRONMENT_NOT_FOUND, DEV_ENVIRONMENT_PHP_VERSIONS, } from '../lib/constants/dev-environment'; @@ -38,21 +37,26 @@ const usage = 'vip dev-env update'; const examples = [ { usage: `${ exampleUsage } --slug=example-site`, - description: 'Update or confirm all settings for the local environment named "example-site" in the setup wizard.', + description: + 'Update or confirm all settings for the local environment named "example-site" in the setup wizard.', }, { usage: `${ exampleUsage } --php=8.2 --slug=example-site`, - description: 'Update the PHP version to 8.2 in the `update` command then enter the setup wizard to update or confirm all other settings.\n' + - ' * Configuration options that are set in the `update` command will be skipped in the setup wizard.', + description: + 'Update the PHP version to 8.2 in the `update` command then enter the setup wizard to update or confirm all other settings.\n' + + ' * Configuration options that are set in the `update` command will be skipped in the setup wizard.', }, { usage: `${ exampleUsage } --app-code=/Users/example/Desktop/example-app-code --slug=example-site`, - description: 'Update application code to load from a path on the user\'s local machine for the local environment.', + description: + "Update application code to load from a path on the user's local machine for the local environment.", }, ]; const cmd = command( { usage, -} ).option( 'slug', 'A unique name for a local environment. Default is "vip-local".', +} ).option( + 'slug', + 'A unique name for a local environment. Default is "vip-local".', undefined, processSlug ); From e2870ea04cb4cf0a64213e22359abc9fd5948ed5 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Wed, 29 May 2024 14:30:08 +0300 Subject: [PATCH 4/5] fix: template literal --- src/bin/vip-dev-env-import-sql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/vip-dev-env-import-sql.js b/src/bin/vip-dev-env-import-sql.js index 33b8a09fa..c4371a733 100755 --- a/src/bin/vip-dev-env-import-sql.js +++ b/src/bin/vip-dev-env-import-sql.js @@ -36,7 +36,7 @@ const examples = [ }, { usage: - '${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"', + `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, description: 'Search and replace 2 pairs of strings during the import of the SQL file to a local multisite environment.', }, From 61b58ea4ca84785bb0b1aa7d5fed97246230c3bc Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Wed, 29 May 2024 14:38:58 +0300 Subject: [PATCH 5/5] style: fix ESLint issues --- src/bin/vip-dev-env-import-sql.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bin/vip-dev-env-import-sql.js b/src/bin/vip-dev-env-import-sql.js index c4371a733..175ee8c56 100755 --- a/src/bin/vip-dev-env-import-sql.js +++ b/src/bin/vip-dev-env-import-sql.js @@ -35,8 +35,7 @@ const examples = [ 'Perform the search and replace operation on the local SQL file ("file.sql"), save the changes, and import the updated file to the local environment.', }, { - usage: - `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, + usage: `${ exampleUsage } /Users/example/Downloads/file.sql --search-replace="example-site.com/site-three,site-three.example-site.vipdev.lndo.site" --search-replace="example-site.com,example-site.vipdev.lndo.site" --slug="example-site"`, description: 'Search and replace 2 pairs of strings during the import of the SQL file to a local multisite environment.', },