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

Add initial #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add initial #5

wants to merge 3 commits into from

Conversation

duralog
Copy link

@duralog duralog commented Nov 20, 2014

this adds initial values to the parse function.

I additionally added a whole bunch of tests and also nearly committed some tabs too, and realized you didn't have an editorconf

cool lib bro!

@gkz
Copy link
Owner

gkz commented Nov 21, 2014

Looks interesting. Can you go over some use cases? How is this better than using default arguments?

@duralog
Copy link
Author

duralog commented Nov 21, 2014

I load a config using the rc module, (this allows me to have a separate config for each project, yet one "base" config in the directory below the project that all the configs are derived from.

I can use default for each option, however, if one of the options is't defined in the config it will give an error because undefined is converted to a string.

so, instead of checking undefined for every option, an initial option gave me the results I was looking for.

additionally, I plan to use this parser in a REPL I'm working on, and rebuilding the options array for each command (command's defaults depend on the directory in which you run it), it would make that a lot easier as well

:)

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.

2 participants