[core] Use optparse in TApplication's option parsing#22689
Conversation
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
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Not really clean given we also have root-config as a separate CLI
There was a problem hiding this comment.
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
| [file1_C.so...fileN_C.so] Load and execute file1_C.so ... fileN_C.so (or .dll if on Windows) | ||
| They should be already-compiled ROOT macros (shared libraries) or: | ||
| regular user shared libraries e.g. userlib.so with a function userlib(args) | ||
| [anyfile1..anyfileN] All other arguments pointing to existing files will be checked to see if they are ROOT Files (checking the MIME type inside the file) and if they are not they will be handled as a ROOT macro file |
There was a problem hiding this comment.
| [anyfile1..anyfileN] All other arguments pointing to existing files will be checked to see if they are ROOT Files (checking the MIME type inside the file) and if they are not they will be handled as a ROOT macro file | |
| [anyfile1..anyfileN] All other arguments pointing to existing files will be checked to see if they are ROOT Files (checking the MIME type inside the file) and if they are not they will be handled as a ROOT macro file |
| } | ||
|
|
||
| // Process positional arguments after `--` as arguments for the macro. | ||
| // This is only valid if we passed at least one macro and will be considered arguments for the last one passed. |
There was a problem hiding this comment.
I may have missed it, is this bit of information documented in the help message?
There was a problem hiding this comment.
No; it's not there in the original message and I didn't add anything to it. I can do it in another commit if you want
There was a problem hiding this comment.
As you prefer, it looks like something that should be visible to the user. We can have it in this PR or a followup, I don't have a strong preference
Test Results 20 files 20 suites 3d 7h 18m 7s ⏱️ For more details on these failures, see this check. Results for commit 10eb727. |
This Pull request:
replaces
TApplication::GetOptions's implementation with one using the newoptparse.hxxfunctionality. All existing flags are preserved for backward compatibility, but:-ais not working as intended, so it's now ignored-splashseemed unused, so it's ignored as wellDue 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 torootxandhaddand eventually get rid of the wholeargparse2help.pyfunctionality.