experiment with using clap (builder API version) #4056
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
DISCLAIMER
part of this PR was generated using chatGPT. specifically the
build_cli
function, and the code that translates the parsedmatches
to aCommand
. I have read the generated code and modified slightly. I understand this might raise some questions, but I wanted to have a quick PoC since we haven't committed to anything.-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
I was wrong and it seems that the compilation is notably faster (2.6s master, 3s builder API, 3.7s derive API).
On the other hand as mentioned in #4036 the code is more complex. There is even a degree of duplication since we have to not only define the parser, but then also translate the
matches
into aCommand
.Also note that
clap
introduces ahelp
subcommand, so that./miri --help
and./miri help
are equivalent. I don't know if there is a way to opt-out of this, but if it is a problem I can look further into it.As with the other PR this needs more polishing, which I can do when we decide what we want to do.