Packages
A typed Elixir wrapper for the Docker CLI with struct-based commands and pipeline composition
Current section
Files
Jump to
Current section
Files
lib/docker/commands/builder/inspect.ex
defmodule Docker.Commands.Builder.Inspect do
@moduledoc """
Implements the `Docker.Command` behaviour for `docker buildx inspect`.
"""
@behaviour Docker.Command
import Docker.Command, only: [add_flag: 3]
defstruct [:name, bootstrap: false]
@type t :: %__MODULE__{}
def new, do: %__MODULE__{}
def new(name), do: %__MODULE__{name: name}
def bootstrap(%__MODULE__{} = cmd), do: %{cmd | bootstrap: true}
@impl true
def args(%__MODULE__{} = cmd) do
base =
["buildx", "inspect"]
|> add_flag(cmd.bootstrap, "--bootstrap")
if cmd.name, do: base ++ [cmd.name], else: base
end
@impl true
def parse_output(stdout, 0), do: {:ok, stdout}
def parse_output(stdout, exit_code), do: {:error, {stdout, exit_code}}
end