Skip to content

Commit

Permalink
Add db command
Browse files Browse the repository at this point in the history
And move `phpmyadmin` as a subcommand of the db command
  • Loading branch information
aswasif007 committed Nov 1, 2023
1 parent d41dea5 commit 8c8e829
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"vip-config-software": "dist/bin/vip-config-software.js",
"vip-config-software-get": "dist/bin/vip-config-software-get.js",
"vip-config-software-update": "dist/bin/vip-config-software-update.js",
"vip-db": "dist/bin/vip-db.js",
"vip-db-phpmyadmin": "dist/bin/vip-db-phpmyadmin.js",
"vip-dev-env": "dist/bin/vip-dev-env.js",
"vip-dev-env-create": "dist/bin/vip-dev-env-create.js",
"vip-dev-env-update": "dist/bin/vip-dev-env-update.js",
Expand Down
6 changes: 3 additions & 3 deletions src/bin/vip-phpmyadmin.ts → src/bin/vip-db-phpmyadmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { PhpMyAdminCommand } from '../commands/phpmyadmin';

const examples = [
{
usage: 'vip phpmyadmin @mysite.develop',
description: 'Open PhpMyAdmin for the @mysite.develop environment',
usage: 'vip db phpmyadmin @mysite.develop',
description: 'Open PhpMyAdmin console for the database of the @mysite.develop environment',
},
];

Expand All @@ -41,7 +41,7 @@ void command( {
envContext: true,
module: 'phpmyadmin',
requiredArgs: 0,
usage: 'vip phpmyadmin',
usage: 'vip db phpmyadmin',
} )
.examples( examples )
.argv( process.argv, async ( arg: string[], { app, env }: { app: App; env: AppEnvironment } ) => {
Expand Down
21 changes: 21 additions & 0 deletions src/bin/vip-db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env node

/**
* External dependencies
*/

/**
* Internal dependencies
*/
import command from '../lib/cli/command';
import { trackEvent } from '../lib/tracker';

void command( { usage: 'vip db' } )
.command( 'phpmyadmin', 'Open PhpMyAdmin console for your application database' )
.example(
'vip db phpmyadmin @mysite.develop',
'Open PhpMyAdmin console for your database of the @mysite.develop environment'
)
.argv( process.argv, async () => {
await trackEvent( 'vip_db_command_execute' );
} );
2 changes: 1 addition & 1 deletion src/bin/vip.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const runCmd = async function () {
.command( 'logs', 'Get logs from your VIP applications' )
.command( 'search-replace', 'Perform search and replace tasks on files' )
.command( 'slowlogs', 'Get slowlogs from your VIP applications' )
.command( 'phpmyadmin', 'Open PHPMyAdmin console for your VIP application database' )
.command( 'db', 'Run operations on your VIP application database' )
.command( 'sync', 'Sync production to a development environment' )
.command( 'whoami', 'Display details about the currently logged-in user' )
.command( 'validate', 'Validate your VIP application and environment' )
Expand Down

0 comments on commit 8c8e829

Please sign in to comment.