coffee-tools / coffee

Reference implementation for a flexible core lightning plugin manager
https://docs.page/coffee-tools/coffee
9 stars 13 forks source link

Support `list` command to show all a plugin that is currently installed by coffe and also available for install #42

Closed vincenzopalazzo closed 1 year ago

vincenzopalazzo commented 1 year ago

Background

To run Coffe you are run the following command cargo run -- --help and you can run the following command to setup coffee for your core lightning node

cargo run -- setup <path of the core lightning file>
cargo run -- remote add lightningd https://github.com/lightningd/plugins.git
cargo run -- install <plugin_name>

Currently, there is no way to show the list of plugin that is installed or available for the user, so this task required to you to complete the list command

Goal

Be able to run the following command

The list command shows all the plugin that is installed by coffee, the output of this command, for now, could be just a list of JSON object

cargo run -- list

The list command shows all the plugin that is available on the remote repository, the output of this command, for now, could be just a list of JSON object

cargo run -- list --remotes

Additional Points

Show the man page of the plugin that are installed, and if the user add --remote show the man page of the repository that is on the remote repository

cargo run -- show <plugin name>
tareknaser commented 1 year ago

So as it stands in the code. In the install function, whenever we install a plugin, we add its path to self.config.plugins_path (which is a vector of strings) as a string. I have already thought about how we could go about implementing the list command in coffee and I propose iterating over this vector and extracting the plugin name for every plugin installed and formatting the output as a JSON object.

Also for the -- list --remotes flag, I think we can iterate over all the plugins in self.repos and extract the plugin names. Then we have the option to either completely not show the installed plugins or just mark the installed plugins as already installed to distinguish them for the user.

Moreover, for the -- show flag, If I understand the end goal correctly, I think we can just show the README.md file from the repo.

I would also like to propose adding a search command. The idea is to look through all available sources for a plugin matching this name.

Can you advise if I am thinking in the right direction? Or if I am missing something?

vincenzopalazzo commented 1 year ago

I would also like to propose adding a search command. The idea is to look through all available sources for a plugin matching this name.

Yes this is another case, inside the interface of the plugin manager there is a seach method.

Can you advise if I am thinking in the right direction? Or if I am missing something?

I think you have a very good picture of the problem! I would like just to improve how we store the plugin but this is another problem

vincenzopalazzo commented 1 year ago

The SoB should be done by email I think? not here and I'm not sure if I can give feedback on it before the proposal period?

Again, we can discuss by email this if you would like.

In addition, till the end of the period you could continue to work on some of the pre-SoB or propose some other problem as pre-SoB

tareknaser commented 1 year ago

Can I get this assigned to me?

Jaiaggarwaaaaal commented 1 year ago

Is this closed?