Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
ArgParse for CakeML #511
This is a relatively simple library for parsing arguments using a declarative interface for specifying which kind of argument/options to take. the following example shows a simple use case.
Assume a program
We use a datatype to represent the configuration of
and write a configuration using the
val foo_conf_def = Define` foo_conf = mkArgsConf [(* -i --input *) <| name := implode "input"; short := #"i"; desc := implode "Input file to use"; has_option := T; (* It spects an option *) cont := (λarg conf. conf with <|input := arg|>) |>; (* -o --output *) <| name := implode "output"; short := #"o"; desc := implode "Output file"; has_option := T; cont := (λarg conf. conf with <|input := arg|>) |>; (* -h --help *) <| name := implode "help"; short := #"h"; desc := implode "This message"; has_option := F; cont := K (λconf. conf with <|help := T|>)|> ] (* Default configuration *) <|input := NONE; output := NONE; help := F |> `;
This is just the core functionality since there are still some quality of life components missing (help message generation, helper functions, etc).
Doing some more digging,