HostKit.CommandLine (host_kit v0.1.0-beta.5)

Copy Markdown View Source

A parsed or built simple command line stored as argv.

Summary

Functions

Builds a command line from a command, positional args, and structured CLI options.

Types

option_style()

@type option_style() :: :gnu | :equals | :single_dash | :short | :underscore

t()

@type t() :: %HostKit.CommandLine{
  args: [String.t()],
  ast: term(),
  command: String.t(),
  source: String.t() | nil
}

Functions

argv(command, opts \\ [])

@spec argv(
  String.t(),
  keyword()
) :: t()

Builds a command line from a command, positional args, and structured CLI options.

parse(source)

@spec parse(String.t()) :: {:ok, t()} | {:error, term()}

parse!(source)

@spec parse!(String.t()) :: t()