You'll notice that our main.ml module currently does nothing except print a message saying that it is converting some attachments.
We will do a full command line interface spec in a later issue, probably using Daniel Buenzli's cmdliner library, but for this issue, the goal is just to get the world's simplest command line executable module up and running, in main.ml. Just splitting the argv list on whitespace should do it for these purposes. (Note that Prelude defines an argv constant in the form of a list, which tends to be easier to work with than the argv array that Stdlib provides. It also provides an argv0 constant, in case you need to make reference to the name under which the utility is run.)
Beyond that, this first stab at an excutable should:
assume it will be given the text of a single email via standard in
parse that text into an email AST and convert whatever attachments in it the configuration file says should be converted
print the result to standard out
Later on, when we flesh this out into a more mature 'minimum viable product' version of the command line interface, we will probably retain this 'pass one email into stdin and convert attachments in it to stdout' functionality as a way to run the utility, if need be, with the right command line options. It will likely be quite useful to have around for testing.
Create Minimal Executable
You'll notice that our
main.ml
module currently does nothing except print a message saying that it is converting some attachments.We will do a full command line interface spec in a later issue, probably using Daniel Buenzli's
cmdliner
library, but for this issue, the goal is just to get the world's simplest command line executable module up and running, inmain.ml
. Just splitting theargv
list on whitespace should do it for these purposes. (Note thatPrelude
defines anargv
constant in the form of a list, which tends to be easier to work with than theargv
array thatStdlib
provides. It also provides anargv0
constant, in case you need to make reference to the name under which the utility is run.)Beyond that, this first stab at an excutable should:
Later on, when we flesh this out into a more mature 'minimum viable product' version of the command line interface, we will probably retain this 'pass one email into stdin and convert attachments in it to stdout' functionality as a way to run the utility, if need be, with the right command line options. It will likely be quite useful to have around for testing.