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

Pass correct arguments for create routines to constructors #25

Merged
merged 4 commits into from
Jan 23, 2023

Conversation

shadowspawn
Copy link
Contributor

@shadowspawn shadowspawn commented Jan 19, 2023

Problem: Not passing through correct number of options for createOption.

I got the methods and arguments tangled in the previous PR: #23

See: #22 and #22 (comment)

A more careful comparison...

Underlying Javascript

createCommand(name)
createOption(flags, description) 
createArgument(name, description)

TypeScript declaration

export function createCommand(name?: string): Command;
export function createOption(flags: string, description?: string): Option;
export function createArgument(name: string, description?: string): Argument;

New implementation

exports.createCommand = (name) => new commander.Command(name);
exports.createOption = (flags, description) => new commander.Option(flags, description);
exports.createArgument = (name, description) => new commander.Argument(name, description);

@shadowspawn shadowspawn marked this pull request as draft January 19, 2023 15:44
@shadowspawn shadowspawn marked this pull request as ready for review January 21, 2023 01:19
@shadowspawn
Copy link
Contributor Author

shadowspawn commented Jan 21, 2023

Note: this PR includes a fix for the tests on Node 14. Added some runtime tests, which means now need Commander installed too for the tests which does not happen by default on Node 14.

Used Jest for the tests which is overkill for just 3 tests currently, but is what we use in Commander so familiar and will allow moving tests between repos when useful.

Copy link
Contributor

@abetomo abetomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

package.json Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants