-
-
Notifications
You must be signed in to change notification settings - Fork 992
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
Add helpful command argument descriptions #4057
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There is no reason we should be reflecting and creating a new instance for every command execution
triagonal
reviewed
Mar 15, 2021
JRoy
commented
Mar 15, 2021
JRoy
commented
Mar 15, 2021
Co-authored-by: triagonal <10545540+triagonal@users.noreply.github.com>
JRoy
commented
Mar 15, 2021
mdcfe
approved these changes
May 10, 2021
man this is gonna break a pr or two |
JRoy
changed the title
Implement advanced command argument descriptions
Add helpful command argument descriptions
May 10, 2021
or twelve |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Information
Improves command usage strings by providing a detailed explanation of all possible arguments which shows where old usages showed as well as in the essentials help command
Att #3892
Details
Command instance creations are now cached and kept throughout the lifecycle of the plugin rather than be created for each command execution. This is a performance optimization but also allows for us to cache formatted command usage strings (also helping performance).
Upon command instance creation, the command will brute force search translations with the naming
<command>CommandUsage<ascending number>
and<command>CommandUsage<ascending number>Description
and will stop brute forcing when it doesn't see any new usages./~https://github.com/JRoy/Essentials-PR/blob/c1490fc686854b70d9e8c696fc2c88d1b538fc2c/Essentials/src/main/java/com/earth2me/essentials/commands/EssentialsCommand.java#L58-L67
These translation lines are then formatted with colors for required an optional parameters.
/~https://github.com/JRoy/Essentials-PR/blob/c1490fc686854b70d9e8c696fc2c88d1b538fc2c/Essentials/src/main/java/com/earth2me/essentials/commands/EssentialsCommand.java#L70-L79
These, now formatted usages are stored in the usage cache and will be displayed as such when a
NotEnoughArgumentsException
has occurred./~https://github.com/JRoy/Essentials-PR/blob/c1490fc686854b70d9e8c696fc2c88d1b538fc2c/Essentials/src/main/java/com/earth2me/essentials/Essentials.java#L722-L732
Demonstration:
yte954.mp4