Skip to content

[FEATURE REQUEST] Add ability to write "plugin" apps #1486

@simonwistow

Description

@simonwistow

Is your feature request related to a problem? Please describe.
It would be nice to add features which don't rely on PRs to the main app. Either because they're somewhat throwaway or we don't want to support them as maintainers or because a 3rd party wants to add them.

Examples might include:

Describe the solution you'd like
A common pattern in CLIs is to have a list of builtin commands but, if a command is passed that isn't built in the cli app will look for a binary in $PATH called <name>-<command>

So, for example calling

fastly help
fastly sso
fastly user create [email protected] --name="Example McExample"

would call the built in commands but

fastly mcp api --http :8080

would look for a binary called fastly-mcp and then exec that with the command line args api --http :8080.

Describe alternatives you've considered
Go plugins might be a way forward but

  • Installation could be a pain (have to write to a specific place rather than just in $PATH)
  • Plugins are currently supported only on Linux, FreeBSD, and macOS, making them unsuitable for applications intended to be portable.
  • Plugins are poorly supported by the Go race detector. Even simple race conditions may not be automatically detected. See https://go.dev/issue/24245 for more information.

Additional context
app.Init does a lot of work to load configs, capture STDERR and STDIO, trap exit() etc ... it would be nice if that was abstracted in a way that plugins could easily reuse that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions