Skip to content

[core] Use optparse in TApplication's option parsing#22689

Open
silverweed wants to merge 6 commits into
root-project:masterfrom
silverweed:tapplication_optparse
Open

[core] Use optparse in TApplication's option parsing#22689
silverweed wants to merge 6 commits into
root-project:masterfrom
silverweed:tapplication_optparse

Conversation

@silverweed

@silverweed silverweed commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This Pull request:

replaces TApplication::GetOptions's implementation with one using the new optparse.hxx functionality. All existing flags are preserved for backward compatibility, but:

  • -a is not working as intended, so it's now ignored
  • -splash seemed unused, so it's ignored as well
  • long versions of all short flags are added, for readability

Due to this change, we don't need anymore to generate the command line header file via root-argparse.py. In a future PR I intend to do the same changes to rootx and hadd and eventually get rid of the whole argparse2help.py functionality.

1. ability to ignore unknown flags and query all unprocessed arguments.
   This is useful for stuff like TApplication that needs to "pass through"
   unknown flags;
2. ability to query which arguments came after `--`. This is almost
   never needed, but it is used as a feature by, again, TApplication.
This allows accepting args coming from a `char **` and without
const-casting it to `const char **`.

@vepadulano vepadulano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this effort! I left a couple of minor comments.

-t, --enable-threading Enable thread-safety and implicit multi-threading (IMT)
-q, --quit-after-processing Exit after processing command line macro files
-l, --no-banner Do not show the ROOT banner
-config print ./configure options

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not for this PR, but just wanted to note that I didn't even know this existed, I tried it and I still don't understand what is the intended use case for it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not really clean given we also have root-config as a separate CLI

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would be in favor of removing it (alongside -splash and maybe the argument-less --web), but we need to decide whether we want to break compatibility. Perhaps for root 7? @dpiparo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's early to do this for 6.42, and discussing that would cause a momentum loss. Can we maybe go ahead with this PR and then discuss the removal of the 2 options above separately?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. For now should we mark them as deprecated but keep accepting them?

Comment thread core/base/src/TApplication.cxx Outdated
Comment thread core/base/src/TApplication.cxx
Comment thread core/base/src/TApplication.cxx
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 16h 11m 42s ⏱️
 3 876 tests  3 850 ✅ 0 💤 26 ❌
79 734 runs  79 708 ✅ 0 💤 26 ❌

For more details on these failures, see this check.

Results for commit 5c9edbf.

♻️ This comment has been updated with latest results.

@silverweed silverweed requested a review from vepadulano June 29, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants