-
-
Notifications
You must be signed in to change notification settings - Fork 90
Refactor entire command system #209
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
base: master
Are you sure you want to change the base?
Conversation
|
I would have also liked to remove There was also an attempt at creating a macro based DSL, but that failed miserably as rusts nice compiler errors turn not so nice very quickly when using macros. Although you could still add a DSL on top of the new It may also make sense to extract the core command infrastructure (so everything except the command definitions) into its own crate, although I am not sure if this would be a good idea. The worldedit stuff could possibly also be extracted, but again, not sure if this makes sense. |
c8836d6 to
d01f43e
Compare
|
Thanks for taking on this mammoth of a task |
dfd9477 to
bcc9dc7
Compare
This PR refactors all command related stuff into a new cohesive unified and declarative command system.
Commands are defined using a builder pattern with and a tree structure of
CommandNodes.This provides centralized command registration, better safer argument parsing, autocomplete generation, usage hints and nice error messages.
All command related stuff have been reorganized into core/src/commands/ and generic worldedit stuff into core/src/worldedit/.
The commands are defined in core/src/commands/builtin/.
The "normal" and worldedit commands are not longer split and are now equal citizens.
I also cleaned up some code around core/src/plot/mod.rs
New Features
/help [<command>]commandnot sure which anymoreEDIT: I rediscovered at least the important one I fixed, there was a missing- 1forx,yandzin worldedit::execute::execute_paste)Config.tomland integrates nicely with autocomplete in most part.For now I have marked this as a draft, as I did not have the time to confirm all commands work without any regressions.
The error messages could also still be improved for certain cases. Same goes for some commands while we are at it.
Btw this PR is mutually exclusive with basically every other currently open PRs, so we should probably address them first (And I will have the enjoyment of fixing the endless amounts of merge conflicts that will result from that-).