Skip to content

Conversation

@evanlucas
Copy link
Contributor

Initial getopt implementation for option parsing. Supersedes #1726.

I split out the actual options to try and make it more maintainable.

@evanlucasevanlucas mentioned this pull request May 26, 2015
2 tasks
@mscdex
Copy link
Contributor

It would be nice if we could generate the help text from the defined options. That would help avoid duplication.

@evanlucas
Copy link
ContributorAuthor

I think that's definitely doable. I'll see if I can add that tonight.

@evanlucasevanlucasforce-pushed the getopt branch 5 times, most recently from dd59140 to b06ff7bCompareMay 27, 2015 05:27
@evanlucas
Copy link
ContributorAuthor

Ok, help is automatically generated now too :]

Copy link
Member

Choose a reason for hiding this comment

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

I suggest you remove this code. I don't think many people would expect POSIXLY_CORRECT to affect the iojs binary.

@evanlucasevanlucasforce-pushed the getopt branch 2 times, most recently from c78d8f8 to 65a192eCompareMay 27, 2015 18:11
@brendanashworthbrendanashworth added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 27, 2015
@evanlucas
Copy link
ContributorAuthor

Switched to use a global variable node_options

src/node.h Outdated
Copy link
Member

Choose a reason for hiding this comment

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

For the love of $DEITY, please don't make this public.

@bnoordhuis
Copy link
Member

It's probably a good idea to add some option parsing regression tests.

@evanlucas
Copy link
ContributorAuthor

Ok, made requested changes and added tests for options that are not currently being tested

Copy link
Member

Choose a reason for hiding this comment

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

This is not 100% sound, the output can get split over multiple chunks. Can I suggest you use spawnSync instead?

EDIT: Or execFile, like you do below.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

sure, will update that now. Want me to do that on all of these tests?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, please.

@bnoordhuis
Copy link
Member

LGTM with nits and assuming the CI is happy.

@evanlucas
Copy link
ContributorAuthor

@evanlucasevanlucasforce-pushed the getopt branch 3 times, most recently from a7752f6 to 68357e3CompareMay 29, 2015 16:39
@evanlucas
Copy link
ContributorAuthor

Ok, working on SmartOS support right now. Will run another CI once I get that done.

@evanlucasevanlucasforce-pushed the getopt branch 2 times, most recently from 3019a34 to eadc181CompareMay 29, 2015 18:41
@evanlucas
Copy link
ContributorAuthor

Ok, final CI: https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/736/

Last one had failures related to #1837.

@evanlucas
Copy link
ContributorAuthor

Does this need to wait until 3.0?

@bnoordhuis
Copy link
Member

If there are no user-visible changes, it can go into a patch release.

@evanlucas
Copy link
ContributorAuthor

The actual help message that is printed is slightly different since it is automatically generated based on the options.

Options have been moved into the NodeOptions class. A new global, node_options now exists and is used to access the options after the command line arguments have been parsed. PR-URL: nodejs#1804 Reviewed-By: Ben Noordhuis <[email protected]>
@evanlucasevanlucas deleted the getopt branch June 1, 2015 13:42
@evanlucasevanlucas merged commit c0e7bf2 into nodejs:masterJun 1, 2015
@evanlucas
Copy link
ContributorAuthor

Landed in c0e7bf2. Thanks for the multiple reviews @bnoordhuis

@jbergstroem
Copy link
Member

When this lands again, could we possibly look at expanding the cctest suite?

@evanlucas
Copy link
ContributorAuthor

sure

andrewdeandrade pushed a commit to andrewdeandrade/node that referenced this pull request Jun 3, 2015
Options have been moved into the NodeOptions class. A new global, node_options now exists and is used to access the options after the command line arguments have been parsed. PR-URL: nodejs/node#1804 Reviewed-By: Ben Noordhuis <[email protected]>
@rvaggrvagg mentioned this pull request Jun 11, 2015
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@evanlucas@mscdex@bnoordhuis@jbergstroem@brendanashworth