Contents

tool(named:)

Finds a command-line executable available to the plugin.

Declaration

func tool(named name: String) throws -> PluginContext.Tool

Parameters

  • name:

    The name of the executable to find.

Return Value

Information about the matching host executable.

Discussion

The plugin host first looks for a matching tool provided by a direct dependency of the plugin target. Use the target name for an executable target dependency, the product name for an executable product dependency, or the executable artifact name from the artifact bundle metadata for a binary target dependency.

If no declared dependency provides a matching tool, tool(named:) searches additional directories supplied by the plugin host, in the order provided. The host determines which directories, if any, it supplies. Declare every required tool as a plugin dependency to make the plugin portable between Swift Package Manager, IDEs, and other hosts.

Tool names are case sensitive.

See Also

Inspecting the Context