jgdv.util.plugins.selector

A function to select an appropriate plugin by passed in name or names

Functions

plugin_selector(plugins, *[, target, fallback])

Selects and loads a plugin from a chainguard,

Module Contents

jgdv.util.plugins.selector.plugin_selector(
plugins,
*,
target='default',
fallback=None,
) <Unknown>[source]

Selects and loads a plugin from a chainguard, based on a target, with an available fallback constructor

if the target is a suitable coderef, it is coerced and loaded instead, bypassing the plugins

Parameters:
  • plugins (jgdv.structs.chainguard.ChainGuard)

  • target (str)

  • fallback (jgdv.Maybe[type | str | jgdv.structs.strang.CodeReference])

Return type:

jgdv.Maybe[type]