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

AVRO-4109: [C++] Remove boost::program_options #3286

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wgtmac
Copy link
Member

@wgtmac wgtmac commented Jan 10, 2025

What is the purpose of the change

Remove boost::program_options

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Documentation

  • Does this pull request introduce a new feature? no

@github-actions github-actions bot added the C++ Pull Requests for C++ binding label Jan 10, 2025
}

// Options that require a value
if (i + 1 >= argc) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unfortunate as providing an unknown option at the end of the argument list will produce this error rather than unknown option.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! Fixed.

if (arg == "-U" || arg == "--no-union-typedef") {
opts.noUnionTypedef = true;
} else if (arg == "-p" || arg == "--include-prefix") {
if (i + 1 >= argc) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of repeating the error display multiple times, we can use:

    if (i + 1 < argc) {
         opts.includePrefix = argv[++i];
         continue;
    }

And add at the end of the loop body (so that it executes if the condition is not met):

            std::cerr << "Missing value for option: " << arg << std::endl;
            return false;

return true;
}

if (arg == "-V" || arg == "--version") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also check if there are any more arguments? For example, if someone type avrogencpp -V -U, should we just show the version or error out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ Pull Requests for C++ binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants