neo-node icon indicating copy to clipboard operation
neo-node copied to clipboard

Create CommandListPlugin attached to neo-cli

Open igormcoelho opened this issue 6 years ago • 5 comments
trafficstars

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).

igormcoelho avatar Aug 12 '19 16:08 igormcoelho

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

igormcoelho avatar Aug 12 '19 16:08 igormcoelho

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

shargon avatar Aug 12 '19 19:08 shargon

We can add events to Plugins.

erikzhang avatar Aug 15 '19 07:08 erikzhang

Fully agree on event modeling, cleaner and easier to maintain.

igormcoelho avatar Aug 21 '19 11:08 igormcoelho

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?

lock9 avatar Sep 10 '19 20:09 lock9

Old, if remains, please re-open

shargon avatar Dec 05 '23 13:12 shargon