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

fix: parse direct also inside init to make it work in programmatic usage #66

Merged
merged 1 commit into from
Apr 1, 2023

Conversation

beawar
Copy link
Contributor

@beawar beawar commented Feb 27, 2023

To keep the same interface between the arguments passed through the cli, and the arguments passed throught the programmatic usage, the declaration of the init function define the direct arg as a boolean.
This is not entirerly true in the usage from the cli, since inside the parse function, the direct argument is converted to a number (0 or Infinite).

In order to make both the usages work with the same interface for the args, the PR adds an additional function in charge of preparing the arguments for being used in the core logic.

Specifically for this case, the direct argument is converted from a boolean to an integer as done in the setDefaults for the cli usage, only when it arrives from the init as true, or as someting differnt from a number.

fixes #35

Copy link
Owner

@RSeidelsohn RSeidelsohn left a comment

Choose a reason for hiding this comment

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

Good improvement, thanks a lot!

@RSeidelsohn RSeidelsohn merged commit a965f44 into RSeidelsohn:master Apr 1, 2023
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.

The direct option, when using the init api seems to be backward
2 participants