From be679bd4e17c4f01daa19539a69476c689511a53 Mon Sep 17 00:00:00 2001 From: Terri Ann Swallow Date: Tue, 16 Apr 2024 15:53:35 -0400 Subject: [PATCH 1/3] Update the slowlogs command to follow the VIP-CLI styleguide. --- src/bin/vip-slowlogs.ts | 23 +++++++++++++++-------- src/bin/vip.js | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/bin/vip-slowlogs.ts b/src/bin/vip-slowlogs.ts index 2bc399eb5..44d50c95a 100755 --- a/src/bin/vip-slowlogs.ts +++ b/src/bin/vip-slowlogs.ts @@ -24,6 +24,9 @@ const DEFAULT_POLLING_DELAY_IN_SECONDS = 30; const MIN_POLLING_DELAY_IN_SECONDS = 5; const MAX_POLLING_DELAY_IN_SECONDS = 300; +const exampleUsage = 'vip @example-app.develop slowlogs'; +const baseUsage = 'vip slowlogs'; + export async function getSlowlogs( arg: string[], opt: GetSlowLogsOptions ): Promise< void > { validateInputs( opt.limit, opt.format ); @@ -188,26 +191,30 @@ void command( { envContext: true, format: false, module: 'slowlogs', + usage: baseUsage, } ) .option( 'limit', 'The maximum number of log lines', 500 ) .option( 'format', 'Output the log lines in CSV or JSON format', 'table' ) .examples( [ { - description: 'Get the most recent app slowlogs', - usage: 'vip @mysite.production slowlogs', + description: + 'Retrieve up to 500 of the most recent entries from the MySQL slow query logs in the default text format.', + usage: exampleUsage, }, { - usage: 'vip @mysite.production slowlogs --limit 100', - description: 'Get the most recent 100 slowlog entries', + description: + 'Retrieve the 100 most recent entries from the MySQL slow query logs in the default text format.', + usage: `${ exampleUsage } --limit=100`, }, { - usage: 'vip @mysite.production slowlogs --limit 100 --format csv', description: - 'Get the most recent 100 slowlog entries formatted as comma-separated values (CSV)', + 'Retrieve the 100 most recent entries from the MySQL slow query logs in CSV format.', + usage: `${ exampleUsage } --limit=100 --format=csv`, }, { - usage: 'vip @mysite.production slowlogs --limit 100 --format json', - description: 'Get the most recent 100 slowlog entries formatted as JSON', + description: + 'Retrieve the 100 most recent entries from the MySQL slow query logs in JSON format.', + usage: `${ exampleUsage } --limit=100 --format=json`, }, ] ) .argv( process.argv, getSlowlogs ); diff --git a/src/bin/vip.js b/src/bin/vip.js index 0312d6bf7..35a4854fb 100755 --- a/src/bin/vip.js +++ b/src/bin/vip.js @@ -35,7 +35,7 @@ const runCmd = async function () { .command( 'import', 'Import media or SQL files into your VIP applications' ) .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( 'slowlogs', 'Retrieve MySQL slow query logs from an environment.' ) .command( 'db', "Access an environment's database." ) .command( 'sync', 'Sync production to a development environment' ) .command( 'whoami', 'Retrieve details about the current authenticated VIP-CLI user.' ) From f52e7590ab6e03729996af1f3c0284f757d886e9 Mon Sep 17 00:00:00 2001 From: Terri Ann Swallow Date: Wed, 17 Apr 2024 11:21:23 -0400 Subject: [PATCH 2/3] Update example descriptions based on PR feedback. --- src/bin/vip-slowlogs.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/vip-slowlogs.ts b/src/bin/vip-slowlogs.ts index 44d50c95a..a4e09b97c 100755 --- a/src/bin/vip-slowlogs.ts +++ b/src/bin/vip-slowlogs.ts @@ -198,22 +198,22 @@ void command( { .examples( [ { description: - 'Retrieve up to 500 of the most recent entries from the MySQL slow query logs in the default text format.', + 'Retrieve up to 500 of the most recent entries from the MySQL slow query logs in the default table format.', usage: exampleUsage, }, { description: - 'Retrieve the 100 most recent entries from the MySQL slow query logs in the default text format.', - usage: `${ exampleUsage } --limit=100`, + 'Retrieve up to 50 of the most recent entries from the MySQL slow query logs in the default table format.', + usage: `${ exampleUsage } --limit=50`, }, { description: - 'Retrieve the 100 most recent entries from the MySQL slow query logs in CSV format.', + 'Retrieve up to 100 of the most recent entries from the MySQL slow query logs in CSV format.', usage: `${ exampleUsage } --limit=100 --format=csv`, }, { description: - 'Retrieve the 100 most recent entries from the MySQL slow query logs in JSON format.', + 'Retrieve up to 100 of the most recent entries from the MySQL slow query logs in JSON format.', usage: `${ exampleUsage } --limit=100 --format=json`, }, ] ) From 33ae90fed94775c10db5c239ce84d62235975566 Mon Sep 17 00:00:00 2001 From: Terri Ann Swallow Date: Wed, 17 Apr 2024 17:02:01 -0400 Subject: [PATCH 3/3] Update to consistently use log entries in place of log lines. --- src/bin/vip-slowlogs.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/vip-slowlogs.ts b/src/bin/vip-slowlogs.ts index a4e09b97c..39f67b96c 100755 --- a/src/bin/vip-slowlogs.ts +++ b/src/bin/vip-slowlogs.ts @@ -193,17 +193,17 @@ void command( { module: 'slowlogs', usage: baseUsage, } ) - .option( 'limit', 'The maximum number of log lines', 500 ) - .option( 'format', 'Output the log lines in CSV or JSON format', 'table' ) + .option( 'limit', 'The maximum number of log entries', 500 ) + .option( 'format', 'Output the log entries in CSV or JSON format', 'table' ) .examples( [ { description: - 'Retrieve up to 500 of the most recent entries from the MySQL slow query logs in the default table format.', + 'Retrieve up to 500 of the most recent entries from the MySQL slow query logs in the default format.', usage: exampleUsage, }, { description: - 'Retrieve up to 50 of the most recent entries from the MySQL slow query logs in the default table format.', + 'Retrieve up to 50 of the most recent entries from the MySQL slow query logs in the default format.', usage: `${ exampleUsage } --limit=50`, }, {