Gleam command line argument parsing with basic flag support.


If available on Hex this package can be added to your Gleam project.

gleam add glint


You can import glint as a dependency and use it as follows:

import gleam/io
import gleam/map
import gleam/erlang.{start_arguments}
import glint.{CommandInput}
import glint/flag

pub fn main() {
  let hello_world = fn(input: CommandInput) {
    assert Ok(flag.BoolFlag(caps)) = map.get(input.flags, "caps")

    case caps {
      True -> io.println("HELLO, WORLD!")
      False -> io.println("Hello, World!")
  |> glint.add_command([], hello_world, [flag.string("caps", False)])

Run it with either of: