Idiomatic way to ship command line tools written in Erlang

后端 未结 2 2220
Happy的楠姐
Happy的楠姐 2021-02-20 00:09

The problem

Most of the articles and books about Erlang I could find focus on creating long running server-like applications leaving the process of command line tools

2条回答
  •  面向向阳花
    2021-02-20 00:53

    A small escript that then goes into code from 'conventional' modules could be a solution.

    As an example, Concuerror is expected to be used as a command line tool and uses an escript as its entry point. It handles command-line arguments via getopt. All the main code is in regular Erlang modules, which are included in the path with simple arguments to the escript.

    As far as I understand, NIFs can then be loaded with regular -onload attributes (Concuerror does not use NIFs).

提交回复
热议问题