Libelektra: improve plugin tutorial

Created on 22 Mar 2019  路  9Comments  路  Source: ElektraInitiative/libelektra

Some parts, sometimes needed for implementing plugins, are not yet described in the plugin tutorial (doc/tutorials/plugins.md)

  • [x] elektraPluginGetGlobalKeySet
  • [ ] relevance of /modules in elektraPluginOpen()
  • [ ] exports/genconf (see augeas)
  • [x] /exports/checkconf (see crypto)

@petermax2 Can you take over the description of checkconf?

Most helpful comment

how the type checker plugin could be used to check the plugin config via elektraInvokeGetFunction

That would require somehow inserting the metadata needed by the type checker... It is possible, the type plugin exports a function to check a single key, but most plugins won't need configuration complex enough to warrant that IMHO.

Can the user also add warnings?

AFAIK warnings added to the errorKey are printed during mounting.

I think it would be useful to warn on config keys the plugin does not understand.

I think requiring that plugins provide a specification for their configuration would be a better and more robust approach.

All 9 comments

Btw. maybe we separate the tutorial into the basic parts and advanced parts (like checkconf).

@petermax2 Can you take over the description of checkconf?

Yes, can do.

Btw. maybe we separate the tutorial into the basic parts and advanced parts (like checkconf).

What else (besides checkconf) would be considered "advanced"?

I was just looking at plugins.md and found a description of checkconf (see line 379 ff.). What exactly is missing?

From the current tutorial, I would consider following points advanced:

  • writing C++-based plugins
  • using elektraPluginError (is currently not really described anyway; btw.: not to be confused with ELEKTRA_SET_ERROR)
  • elektraPluginCheckConf

and found a description

Ohh, I did not see it because I used a case-sensitive search.

What exactly is missing?

  • How elektraLineCheckConfig can be exported (here it needs to be written "checkconf", thus I searched for this string).
  • Some guidelines how it should be used.
  • Can the user also add warnings? (I think it would be useful to warn on config keys the plugin does not understand.)
  • even more advanced: how the type checker plugin could be used to check the plugin config via elektraInvokeGetFunction (@kodebach did you already consider doing this?)

I think checkconfig is an important puzzle-piece for overall better usability.

how the type checker plugin could be used to check the plugin config via elektraInvokeGetFunction

That would require somehow inserting the metadata needed by the type checker... It is possible, the type plugin exports a function to check a single key, but most plugins won't need configuration complex enough to warrant that IMHO.

Can the user also add warnings?

AFAIK warnings added to the errorKey are printed during mounting.

I think it would be useful to warn on config keys the plugin does not understand.

I think requiring that plugins provide a specification for their configuration would be a better and more robust approach.

I think requiring that plugins provide a specification for their configuration would be a better and more robust approach.

Yes, definitely. This would be quite a big feature, though.

I can do the part on elektraPluginGetGlobalKeySet.

@vLesk Thank you!

I mark this issue stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping the issue by writing a message here or create a new issue with the remainder of this issue.
Thank you for your contributions :sparkling_heart:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raphi011 picture raphi011  路  32Comments

markus2330 picture markus2330  路  28Comments

markus2330 picture markus2330  路  62Comments

markus2330 picture markus2330  路  27Comments

markus2330 picture markus2330  路  49Comments