Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nothing published, they're typically not very complex.

Things of interest for CLI stuff:

    #!/usr/bin/env elixir
Use Mix.install like so

    Mix.install([
      {:jason, "~> 1.4"},
    ])
Execute shell commands

    {output, status_code} = System.cmd("ls", ["-la"])
For handling files and paths:

    Path.join/2
    __ENV__.file
    Path.dirname/1
    Path.expand/1
    File.lstat/1
    File.read/1
Parsing arguments

    argv = System.argv()
    OptionParser.parse(argv, [strict: [switch: :boolean], aliases: [s: :switch]])
    exit({:shutdown, status_code}) # for shutting down with an error
For printing colors (from docs)

    iex> IO.ANSI.format(["Hello, ", :red, :bright, "world!"], true)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: