Skip to content

Commit

Permalink
Updated command description and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
yolih committed Oct 15, 2024
1 parent b1509e1 commit 5ae8298
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
35 changes: 31 additions & 4 deletions src/bin/vip-wp.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,40 @@ const bindReconnectEvents = ( {
} );
};

// Command examples
const examples = [
{
usage: `vip @example-app.develop -- wp site list`,
description:
'Retrieve the list of network sites on the develop environment of the "example-app" WordPress multisite application.',
},
{
usage: `vip @example-app.production --yes -- wp user list`,
description:
'Retrieve the list of Super Admins on the production environment and automatically answer "yes" to the confirmation prompt.',
},
{
usage: `vip @example-app.develop -- wp post list --posts_per_page=100 --url=site.example.com`,
description: 'Retrieve the list of posts for the network site site.example.com.',
},
{
usage:
`vip @example-app.develop --yes -- wp\n` +
` - example-app.develop:~$ wp option get home\n` +
` - https://dev.example.com`,
description:
'Enter interactive shell mode to run a WP-CLI command like a standard terminal or SSH session.',
},
];

commandWrapper( {
wildcardCommand: true,
appContext: true,
envContext: true,
appQuery,
} )
.option( 'yes', 'Run the command in production without a confirmation prompt' )
.option( 'yes', 'Answer yes to the confirmation prompt (only on production environments).' )
.examples( examples )
.argv( process.argv, async ( args, opts ) => {
const isSubShell = 0 === args.length;

Expand Down Expand Up @@ -292,7 +319,7 @@ commandWrapper( {
// Reset the cursor (can get messed up with enquirer)
process.stdout.write( '\u001b[?25h' );
console.log(
`Welcome to the WP CLI shell for the ${ formatEnvironment(
`Welcome to the WP-CLI shell for the ${ formatEnvironment(
envName
) } environment of ${ chalk.green( appName ) } (${ opts.env.primaryDomain.name })!`
);
Expand Down Expand Up @@ -376,7 +403,7 @@ commandWrapper( {
if ( ( empty || ! startsWithWp ) && ! userCmdCancelled ) {
console.log(
chalk.red( 'Error:' ),
'invalid command, please pass a valid WP CLI command.'
'invalid command, please pass a valid WP-CLI command.'
);
subShellRl.prompt();
return;
Expand Down Expand Up @@ -484,7 +511,7 @@ commandWrapper( {

console.log( 'Command cancelled by user' );

// if no command running (.e.g. interactive shell, exit only after doing cleanup)
// if no command running (.e.g. interactive shell) exit only after doing cleanup
if ( commandRunning === false ) {
process.exit();
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/vip.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const runCmd = async function () {
.command( 'sync', 'Sync the database from production to a non-production environment.' )
.command( 'whoami', 'Retrieve details about the current authenticated VIP-CLI user.' )
.command( 'validate', 'Validate your VIP application and environment' )
.command( 'wp', 'Run WP CLI commands against an environment' );
.command( 'wp', 'Execute a WP-CLI command against an environment.' );

cmd.argv( process.argv );
};
Expand Down

0 comments on commit 5ae8298

Please sign in to comment.