You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm building a modular application which commands are defined by plugins. The problem is that, for security and isolation reasons these plugins are loaded in child processes, not in the same process as the CLI. I'm currently investigating using Spectre Console to parse commands and display results, while the actual processing is done in the child processes. However, it seems that commands and settings can only be added through inheritance and attributes, which in this specific case won't be an option.
Describe the solution you'd like
Additionnaly to the attribute based command declaration API, I would like to be able to declare settings and commands procedurally without creating custom classes. This rises the question of how settings would be provied to commands in this situation, maybe some kind of API related to Dictionary<string,CommandSetting> ?
var app = new CommandApp();
app.Configure(config=>
{
config.AddCommand("foo",cmd=>
{
cmd.AddSetting<bool>("active",setting=>setting.DefaultValue(true).CommandOption("-a|--active"));
cmd.OnExecute((context,settings)=>
{
settings.Get<bool>("active")
});
});
}
Describe alternatives you've considered
Another option would be for Spectre.CLI to be able to both output and consume a model of the list of commands and settings. This model could be serialized and transfered between process boundaries. However in this case, it wouldn't be possible to provide OnExecute methods for commands, and dealing with invocations accross process might add too much complexity to the library for the limited use case. It would probably involve being able to run the parsing frontend without the execution backend of AppCommand, wich is probably quite a complex endeavour.
Note: I would be interested in working on such a feature myself, but I would like input on how feasable it would be.
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm building a modular application which commands are defined by plugins. The problem is that, for security and isolation reasons these plugins are loaded in child processes, not in the same process as the CLI. I'm currently investigating using Spectre Console to parse commands and display results, while the actual processing is done in the child processes. However, it seems that commands and settings can only be added through inheritance and attributes, which in this specific case won't be an option.
Describe the solution you'd like
Additionnaly to the attribute based command declaration API, I would like to be able to declare settings and commands procedurally without creating custom classes. This rises the question of how settings would be provied to commands in this situation, maybe some kind of API related to
Dictionary<string,CommandSetting>
?Describe alternatives you've considered
Another option would be for Spectre.CLI to be able to both output and consume a model of the list of commands and settings. This model could be serialized and transfered between process boundaries. However in this case, it wouldn't be possible to provide
OnExecute
methods for commands, and dealing with invocations accross process might add too much complexity to the library for the limited use case. It would probably involve being able to run the parsing frontend without the execution backend ofAppCommand
, wich is probably quite a complex endeavour.Note: I would be interested in working on such a feature myself, but I would like input on how feasable it would be.
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered: