Command
A type that represents a command, run locally or remotely.
protocol Command : Hashable, Identifiable, Sendable
Browse conforming typesOverview
Conform to the Command protocol to provide the logic for the Formic engine to invoke a command effecting a remote host or service.
The engine calls run(host:logger:)
to invoke the command, providing a Host
instance that presents the host to the logic for executing the command. The engine may provide a Logger
instance, to allow the command to log messages, typically to the console when invoked from a command-line interface. Log output at debug
or trace
log levels within your command. Throw errors to indicate unavoidable error conditions, and report failure conditions by including the relevant information into CommandOutput
that you return from this method.
Inspecting Commands
var id: UUID
The identifier of a command.
var ignoreFailure: Bool
A Boolean value that indicates whether a failing command within a sequence should fail the overall sequence of commands.
var retry: Backoff
The retry settings to apply when a command fails.
var executionTimeout: Duration
The maximum time allowed for the command to execute.
struct Backoff
The retry and backoff delay settings for a command.
Invoking Commands
func run(host: RemoteHost, logger: Logger?
) async throws -> CommandOutput The function that is invoked by an engine to run the command.