diff --git a/example/commands/add.ts b/example/commands/add.ts index 9585817..adb7a4c 100644 --- a/example/commands/add.ts +++ b/example/commands/add.ts @@ -27,6 +27,7 @@ export class AddCommand implements Command { const format = (val: number) => val.toLocaleString(undefined, { useGrouping: thousandSeparators, + minimumFractionDigits: decimalPlaces, maximumFractionDigits: decimalPlaces }); diff --git a/src/commander.test.ts b/src/commander.test.ts index 66456b0..2d930df 100644 --- a/src/commander.test.ts +++ b/src/commander.test.ts @@ -142,7 +142,7 @@ describe('src/commander', () => { }); expect(action).toBeDefined(); await expect(action('john', undefined, {})).resolves.toBeUndefined(); - expect(loginHandler).toHaveBeenCalledWith({ username: 'john' }); + expect(loginHandler).toHaveBeenCalledWith({ username: 'john', rememberMeFor: 7 }); // tslint:disable-next-line:no-console expect(console.error).toHaveBeenCalledWith( expect.stringMatching(/Computer says no/gi) diff --git a/src/commander.ts b/src/commander.ts index 9bf7e4d..4230230 100644 --- a/src/commander.ts +++ b/src/commander.ts @@ -63,7 +63,10 @@ function getParams( const optionValues = args[paramIndex]; for (const option of options) { - params[option.name.toString()] = optionValues[option.name]; + const value = optionValues[option.name]; + if (value !== undefined) { + params[option.name.toString()] = value; + } } return params;