ClaudeWrapper.Command behaviour (ClaudeWrapper v0.6.0)

Copy Markdown View Source

Behaviour for CLI commands.

Every command knows how to build its argument list and how to parse its output. This is the Elixir equivalent of the Rust ClaudeCommand trait.

Summary

Functions

Run a command synchronously via System.cmd.

Types

args()

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

Callbacks

args()

@callback args() :: args()

parse_output(stdout, exit_code)

@callback parse_output(stdout :: String.t(), exit_code :: non_neg_integer()) ::
  {:ok, term()} | {:error, term()}

Functions

run(mod, command, config)

@spec run(module(), struct(), ClaudeWrapper.Config.t()) ::
  {:ok, term()} | {:error, term()}

Run a command synchronously via System.cmd.

Returns the parsed output on success.