docs icon indicating copy to clipboard operation
docs copied to clipboard

Add the documentation about "get_current_plugin_path" method

Open sambarza opened this issue 1 year ago • 3 comments

Document the method "get_current_plugin_path" in the settings page

sambarza avatar Nov 17 '23 18:11 sambarza

We'll try to add also a get_plugin method to get the object itself

Do you thing from a devx point of view, which name is better? get_current_plugin_path get_plugin_path plugin_path ?

pieroit avatar Nov 17 '23 20:11 pieroit

Are two different topics, correct? 1- We'll try to add also a get_plugin method to get the object itself 2- Question about the name

If correct, I like the method to get the current plugin instance, then the dev can do:

get_plugin().load_settings()
get_plugin().path

Maybe the method get_plugin can have the argument plugin_name, if not specified it returns the current plugin instance. Can be useful to get the plugin instance from other plugins?

sambarza avatar Nov 18 '23 23:11 sambarza

Thanks @sambarza merged your idea with @Jhonnyr97 PR (https://github.com/cheshire-cat-ai/core/pull/550)

Now we can do from a plugin:

cat.mad_hatter.get_plugin().id # gets plugin folder name
cat.mad_hatter.get_plugin().path # gets plugin folder path
cat.mad_hatter.get_plugin().load_settings()
cat.mad_hatter.get_plugin().save_settings(settings)

pieroit avatar Nov 20 '23 21:11 pieroit