787 B

33-haskell-optparse-cli

This example shows intermediate Haskell CLI parsing with optparse-applicative.

It includes:

  • subcommands for validation and promotion,
  • named options, repeated options, and typed numeric parsing,
  • a pure parser entry point that the test suite exercises, and
  • a test suite run by nix flake check.

Useful commands:

nix develop
cabal run
cabal run -- validate --service api --env production --replicas 3 --track stable
cabal run -- promote --service api --from-tag blue --to-tag green --owner platform --owner security --dry-run
cabal test

nix build
./result/bin/mini-cli validate --service api --env production --replicas 3 --track stable

nix run . -- validate --service api --env production --replicas 3 --track stable
nix flake check