neo-node
neo-node copied to clipboard
Create CommandListPlugin attached to neo-cli
Perhaps a useful plugin to have attached to neo-cli is a CommandListPlugin, that responds to some prefix commands (example execute), and stores them as a list. It would then dump these commands on a next opportunity.
Example: some plugin may issue a Plugin.SendMessage("execute exit") (perhaps a list notation is best here, to store multiple in a single batch, instead of many), the plugin CommandList would receive and store this exit command, and then would execute it on neo-cli. This could happen before OnCommand(), directly on neocli Base system. Just an idea, for an automation problem @ixje had recently...
This is also useful to create external scripts that just use neo-cli to perform specific tasks and exit (without external control bash scripts, like expect, that are more complicated and platform-specific).
Specifically, the plugin could dump it commands here, before this running = OnCommand() line:
https://github.com/neo-project/neo-cli/blob/master/neo-cli/Services/ConsoleServiceBase.cs#L300
For me plugins should inherit only from Plugin class, and then attach it to the desire event, we should have events around all the classes. Is more extensible.
Related to https://github.com/neo-project/neo/issues/679
We can add events to Plugins.
Fully agree on event modeling, cleaner and easier to maintain.
Has this been decided? Can we rename it to "Add events to plugins"? How do you guys want to proceed? Is this ready to implement?
Old, if remains, please re-open