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

fix: Rename App to Command #3472

Merged
merged 7 commits into from Feb 15, 2022
Merged

fix: Rename App to Command #3472

merged 7 commits into from Feb 15, 2022

Conversation

epage
Copy link
Member

@epage epage commented Feb 15, 2022

In clap2, we had App for top-level commands and subcommands. To read more nicely, we also had a placeholder SubCommand struct that had functions to create an App.

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 expect App to contain core logic". The way that App 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 to Command 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 for App. The main drawback I've found to type aliases is that you can't construct the type with Command {}. Currently, that can only be done with Default and should be rare enough to not be a problem. I did not use a use (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 a use.

This is part of #3089. Remaining work

  • Update IntoApp
  • Update `app_from_crate

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.

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

Successfully merging this pull request may close these issues.

None yet

1 participant