Skip to content
Open
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
12 changes: 12 additions & 0 deletions __e2e__/default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ test('does not pass --platform-name by default', () => {
const {stderr} = runCLI(DIR, [], {expectedFailure: true});
expect(stderr).not.toContain("unknown option '--platform-name'");
});

test.each(['run-ios', 'build-ios'])(
'registers --verbose once for %s',
(command) => {
writeFiles(DIR, {'package.json': '{}'});
const {stdout, exitCode} = runCLI(DIR, [command, '--help']);

expect(exitCode).toBe(0);
expect(stdout.match(/^\s+--verbose\s+/gm)).toHaveLength(1);
expect(stdout).toMatch(/Do not use xcbeautify or\s+xcpretty/);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const getBuildOptions = ({platformName}: BuilderCommand) => {
},
{
name: '--verbose',
description: 'Do not use xcbeautify or xcpretty even if installed',
description:
'Increase logging verbosity. Do not use xcbeautify or xcpretty even if installed',
},
{
name: '--xcconfig [string]',
Expand Down
9 changes: 8 additions & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function attachCommand<C extends Command<boolean>>(

const cmd = program
.command(command.name)
.option('--verbose', 'Increase logging verbosity')
.action(async function handleAction(
this: CommanderCommand,
...args: string[]
Expand Down Expand Up @@ -140,6 +139,14 @@ function attachCommand<C extends Command<boolean>>(
typeof opt.default === 'function' ? opt.default(config) : opt.default,
);
}

if (
!command.options?.some(
(option) => cmd.createOption(option.name).long === '--verbose',
)
) {
cmd.option('--verbose', 'Increase logging verbosity');
}
}

// Platform name is optional argument passed by out of tree platforms.
Expand Down
Loading