alexylem/jarvis-plugin

Add a "config checker file" in plugins

Closed this issue · 3 comments

Hey,

This is a proposal, not an issue:
Since plugin config may be not well done by the user and make the plugin not work properly, it would be great to have a file executed at the startup of Jarvis which checks that the data the user put are valid.

For example, a plugin to send mail could check at jarvis startup that the email and password are valid and warn user if it is not.
A plugin needing a list could check that the variable is really a list, ...

You can already to this at plugin level, ex:
config.sh

myplugin_username="" # let's say the user forgot to set it

functions.sh

myplugin_checkconfig() {
  [ -n "$myplugin_username" ] || jv_error "you must set a username in myplugin config
}

hooks/program_startup

myplugin_checkconfig

Nice!
Sorry for this request then ;)

Np glad to help 😄