parent
412b724292
commit
7fd0c748ba
|
@ -9,6 +9,11 @@ describe('isArgFormatInvalid', () => {
|
|||
expect(isArgFormatInvalid('--t')).toBe(true);
|
||||
});
|
||||
|
||||
test('is false for --x and --y (backwards compat, we should have made these short, oh well)', () => {
|
||||
expect(isArgFormatInvalid('--x')).toBe(false);
|
||||
expect(isArgFormatInvalid('--y')).toBe(false);
|
||||
});
|
||||
|
||||
test('is false for correct long args', () => {
|
||||
expect(isArgFormatInvalid('--test')).toBe(false);
|
||||
});
|
||||
|
|
|
@ -145,8 +145,9 @@ export function getAllowedIconFormats(platform: string): string[] {
|
|||
*/
|
||||
export function isArgFormatInvalid(arg: string): boolean {
|
||||
return (
|
||||
arg.startsWith('---') ||
|
||||
/^--[a-z]$/i.exec(arg) !== null ||
|
||||
/^-[a-z]{2,}$/i.exec(arg) !== null
|
||||
(arg.startsWith('---') ||
|
||||
/^--[a-z]$/i.exec(arg) !== null ||
|
||||
/^-[a-z]{2,}$/i.exec(arg) !== null) &&
|
||||
!['--x', '--y'].includes(arg) // exception for long args --{x,y}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue