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.
In clap2, we had
App
for top-level commands and subcommands. To read more nicely, we also had a placeholderSubCommand
struct that had functions to create anApp
.In clap3,
SubCommand
is deprecated now.App
doesn't fit for subcommands and it mostly doesn't fit for the top-level command. As one user put it, "I would expectApp
to contain core logic". The way thatApp
fits is that app-wide settings are stored in the top-level command, like terminal settings.With that said, it seems most appropriate to rename
App
toCommand
to better fit with user expectations which will hopefully help with onboarding users in the future.Only
\bapp\b
references were updated. There are still references to "app" in internal function names.To maintain backwards compatibility,
Command
is just a type alias forApp
. The main drawback I've found to type aliases is that you can't construct the type withCommand {}
. Currently, that can only be done withDefault
and should be rare enough to not be a problem. I did not use ause
(the more compatible route) because I wanted to ensure there were deprecation notices given to the user and I've not seen those activate when applied to ause
.This is part of #3089. Remaining work
IntoApp
Note:
AppSettings
isn't being renamed because of #2717. There are only a few non-deprecated AppSettings left at this moment and we'll do the rest before releasing clap4.