Skip to content

Commit 44c6910

Browse files
authored
Address review: combine unknown option tests, make --config primary with --config-path alias
Agent-Logs-Url: https://github.com/microsoft/beachball/sessions/13e97a54-84b3-4b4c-adf8-9f0ff9ae878d
1 parent 617f887 commit 44c6910

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

src/__functional__/options/getCliOptions.test.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,23 +215,11 @@ describe('getCliOptions', () => {
215215
expect(getDefaultRemoteBranch).toHaveBeenCalledWith({ branch: 'foo', verbose: undefined, cwd: projectRoot });
216216
});
217217

218-
it('throws on unknown string options', () => {
218+
it('throws on unknown options', () => {
219219
expect(() => getCliOptionsTest(['change', '--foo', 'bar'])).toThrow();
220-
});
221-
222-
it('throws on unknown boolean flags', () => {
223220
expect(() => getCliOptionsTest(['change', '--foo'])).toThrow();
224-
});
225-
226-
it('throws on unknown negated boolean flags', () => {
227221
expect(() => getCliOptionsTest(['change', '--no-bar'])).toThrow();
228-
});
229-
230-
it('throws on unknown option with value', () => {
231222
expect(() => getCliOptionsTest(['change', '--foo', 'true'])).toThrow();
232-
});
233-
234-
it('throws on unknown option specified multiple times', () => {
235223
expect(() => getCliOptionsTest(['change', '--foo', 'bar', '--foo', 'baz'])).toThrow();
236224
});
237225

src/options/getCliOptions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ function addSharedOptions(cmd: Command): Command {
9696
cmd.option('--canary-name <value>', 'canary prerelease name');
9797
cmd.option('--changehint <value>', 'custom hint message when change files are needed');
9898
cmd.option('--change-dir <value>', 'directory to store change files');
99-
cmd.option('-c, --config-path <value>', 'custom beachball config path');
100-
cmd.addOption(new Option('--config <value>').hideHelp()); // hidden alias for --config-path
99+
cmd.option('-c, --config <value>', 'custom beachball config path');
100+
cmd.addOption(new Option('--config-path <value>').hideHelp()); // hidden alias for --config
101101
cmd.option('--dependent-change-type <value>', 'change type for dependent packages');
102102
cmd.option('--since, --from-ref <value>', 'consider changes since this git ref');
103103
cmd.option('-m, --message <value>', 'change description or commit message');
@@ -342,7 +342,7 @@ export function getCliOptions(processOrArgv: ProcessInfo | string[]): ParsedOpti
342342

343343
const commanderOpts = { ...match.opts };
344344

345-
// Handle --config as alias for --config-path
345+
// Handle --config-path as alias for --config (both map to configPath)
346346
if (commanderOpts.config !== undefined) {
347347
if (commanderOpts.configPath !== undefined) {
348348
throw new Error('Cannot specify both --config and --config-path');

0 commit comments

Comments
 (0)