Legend:
Library
Module
Module type
Parameter
Class
Class type
Used to describe Unix-style commands for executing arbitrary shell commands. It is up to the Runtime to use this representation to be cross-platform (for example, to use it with Windows).
The library does not ensure typeafety but should be expressive enough to describe many CLI calls (and can serve as a basis for slightly stricter libraries).
Types
The way an order is structured respects this logic: cmd_name -a --b foo bar1 bar2:
cmd_name is the command name (and is a regular string).
A value can be a plain text or a Yocaml.Path.t (that can be watched to form a dependency set).
# make "a-complicated_command" [
flag "f";
flag "w";
param ~suffix:"=" "priority" @@ s "high";
param "into" @@ w (Yocaml.Path.rel ["foo"; "bar"; "baz"]);
arg @@ list ["a"; "b"; "c"; "d"]
] ;;
- : t =
a-complicated_command -f -w --priority=high --into ./foo/bar/baz a b c d
flag ?prefix name build a shell flag. The default prefix is -. Ie: flag "foo" is "-foo", but flag ~prefix:"--T" "foo" is "--Tfoo".
# flag "foo" ;;
- : arg = -foo
# flag ~prefix:"--T" "foo" ;;
- : arg = --Tfoo
val param : ?prefix:string ->?suffix:string ->string ->value->arg
param ?prefix ?suffix key value build a shell labeled argument. The default prefix is -- and the default suffix is " ". A param use the following scheme: prefix^key^suffix^value. Ie: param "foo" (string "bar") is --foo bar, but param ~prefix:"--T" ~suffix:"=" "foo" (int 10) is --Tfoo=10.
arg x create a plain argument. Ie: arg (string "foo") is foo. Value can be used to deal with non-structured argument, ie: arg (string "--a b --c -d -eee") seems perfectly valid.