Execution
Running a Mélodium program is done with a simple call followed by the file containing the melodium run <FILE>
program.
A direct call to melodium
without a subcommand is equivalent to a call to melodium run
.
If Mélodium is installed on the system by a standard means, the standalone .mel
script files and .jeu
programs are directly executable.
The following calls are equivalent:
$ melodium run my_program.jeu
$ melodium my_program.jeu
$ ./my_program.jeu
Entry point selection
Mélodium programs have entry points.
By default if nothing is specified for the execution call, the main
entry point is searched for and used.
If a program offers other entry points, these are accessible as subcommands.
In the case of a program having an entry point main
as well as serve
and connect
, these three execution calls are valid:
$ ./my_program.jeu [main]
$ ./my_program.jeu serve
$ ./my_program.jeu connect
Arguments
The entry points of a program are simply Mélodium treatments, which can take parameters.
The parameters of a treatment used as an entry point are accessible as arguments for the command line, thus a serve
entry point corresponding to a treatment having as parameters port: u16
and refresh: bool
has equivalent arguments:
$ ./my_program.jeu serve --port 1234 --refresh true
Information about a program
To find out what commands a program has, the melodium info
command lists the available entry points:
$ melodium info ./my_program.jeu
my_program
Version 0.1.0
Usage: my_program.jeu [COMMAND]
Commands:
main
serve
connect
To find out the specific arguments of a command, the --help
argument can be used on it:
$ melodium ./my_program.jeu serve --help
Usage: serve [OPTIONS]
Options:
--port <port> u16
--refresh <bool> bool
-h, --help Print help