Extending okfctl with plugins
okfctl extends git/kubectl-style: an unknown subcommand okfctl foo bar
execs an okfctl-foo binary found on PATH, passing through bar plus the
remaining flags and environment (with OKFCTL set to the core binary’s path so a
plugin can call back), and propagates the plugin’s exit code. Built-in
subcommands always take precedence; an unknown subcommand with no matching plugin
produces the usual error plus a did-you-mean suggestion.
The bundled okfctl-search plugin is the reference example — see
Search.
Discover plugins
Section titled “Discover plugins”okfctl plugin list # okfctl-<name> executables on PATH, sorted; first-on-PATH winsokfctl plugin list --path "$PATH" # inspect a specific PATHExecutable detection uses Unix permission bits (macOS/Linux); Windows is not yet supported.
Install a plugin
Section titled “Install a plugin”okfctl plugin install ./okfctl-mytool # copy into the managed plugins dirokfctl plugin install ./okfctl-mytool --dir ~/binThe default destination is $OKFCTL_CONFIG_HOME/plugins (or <user config dir>/okfctl/plugins), the same config-home convention config uses; override
with --dir. Put that directory on your PATH. The source’s base name must
follow okfctl-<name>; the copy is written with execute bits. If the destination
is not on your PATH, install prints a note to stderr so the plugin is not
silently undiscoverable.