HostKit.Runner behaviour (host_kit v0.1.0-beta.1)

Copy Markdown View Source

Command execution boundary for HostKit apply/deploy operations.

Summary

Types

args()

@type args() :: [String.t()]

command()

@type command() :: String.t()

opts()

@type opts() :: keyword()

result()

@type result() :: {String.t(), non_neg_integer()}

Callbacks

cmd(command, args, opts)

@callback cmd(command(), args(), opts()) :: result()

mkdir_p(t, opts)

@callback mkdir_p(Path.t(), opts()) :: :ok | {:error, term()}

write_file(t, iodata, opts)

@callback write_file(Path.t(), iodata(), opts()) :: :ok | {:error, term()}

Functions

cmd(runner, command, args, opts)

@spec cmd(module() | {module(), keyword()}, command(), args(), opts()) :: result()

mkdir_p(runner, path, opts)

@spec mkdir_p(module() | {module(), keyword()}, Path.t(), opts()) ::
  :ok | {:error, term()}

read_file(path, opts \\ [])

@spec read_file(Path.t(), opts()) :: {:ok, binary()} | {:error, term()}

write_file(runner, path, content, opts)

@spec write_file(module() | {module(), keyword()}, Path.t(), iodata(), opts()) ::
  :ok | {:error, term()}