Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SpectraCli

Spectra’s command grammar, built applicatively with Std Cli.

The executable understands three subcommands, each defaulting its project path to the current directory:

spectra check [PATH]
spectra build [PATH] --output deck.pdf --open
spectra clean [PATH]

Parsing is a pure function over an argument list, so the grammar is its own test surface:

fn main() =
  match parse_spectra_argv(["build", "talk", "--open"]) of
    C.Parsed(cmd) => println(show(cmd))
    _ => println("usage error")
SpectraCli.Build("talk", "deck.pdf", true)

Types

SpectraCommand

type SpectraCommand
  = Check(String)
  | Build(String, String, Bool)
  | Clean(String)
  deriving (Eq, Show)

Functions and Values

spectra_command

spectra_command : Cli.Command(SpectraCommand)

parse_spectra_argv

parse_spectra_argv : (List(String)) -> Cli.Outcome(SpectraCommand)