Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make the help text for the format option consistent for all commands #2129

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bin/vip-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import app from '../lib/api/app';
import command, { getEnvIdentifier } from '../lib/cli/command';
import { trackEvent } from '../lib/tracker';

command( { requiredArgs: 1, format: true } )
command( { requiredArgs: 1 } )
.example(
'vip app list',
'Retrieve a list of applications that can be accessed by the current authenticated VIP-CLI user.'
Expand Down
3 changes: 1 addition & 2 deletions src/bin/vip-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ command( {
.option( 'follow', 'Output new entries as they are generated.' )
.option(
'format',
'Render output in a particular format. Accepts “csv”, “json”, and “text”.',
'table'
'Render output in a particular format. Accepts “table“ (default), “csv“, “json“, and “text”.'
)
.examples( [
{
Expand Down
3 changes: 1 addition & 2 deletions src/bin/vip-slowlogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void command( {
appContext: true,
appQuery,
envContext: true,
format: false,
format: true,
module: 'slowlogs',
usage: baseUsage,
} )
Expand All @@ -199,7 +199,6 @@ void command( {
'Set the maximum number of log entries. Accepts an integer value between 1 and 500.',
500
)
.option( 'format', 'Render output in a particular format. Accepts “csv”, and “json”.', 'table' )
.examples( [
{
description:
Expand Down
2 changes: 1 addition & 1 deletion src/bin/vip-validate-preflight.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ function sanitizeArgsForTracking( args ) {

let commandOpts = {
module: 'harmonia',
format: true,
};

// The @app.env selector is optional, so we need to check if it was passed
Expand Down Expand Up @@ -601,7 +602,6 @@ command( commandOpts )
[ 'p', 'port' ],
'Configure the port to use for the app (defaults to a random port between 3001 and 3999)'
)
.option( 'format', 'Output the log lines in CSV or JSON format', 'table' )
.option( [ 'P', 'path' ], 'Path to the app to be tested', process.cwd() )
.examples( [
{
Expand Down
7 changes: 5 additions & 2 deletions src/lib/cli/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ args.argv = async function ( argv, cb ) {
debug: false,
} );

if ( _opts.format && ! options.format ) {
options.format = 'table';
}

if ( options.h || options.help ) {
this.showHelp();
}
Expand Down Expand Up @@ -603,8 +607,7 @@ export default function ( opts ) {
if ( _opts.format ) {
args.option(
'format',
'Render output in a particular format. Accepts “csv”, and “json”.',
'table'
'Render output in a particular format. Accepts “table“ (default), “csv“, and “json“.'
);
}

Expand Down