OCaml: Add simulate (dry run) configuration option

This commit is contained in:
Juno Takano 2025-05-17 00:48:49 -03:00
commit 9e9a9566db
5 changed files with 42 additions and 25 deletions

View file

@ -17,11 +17,17 @@ type os = Unknown | FreeBSD | Void | Alpine
type host = { os : os; name : string }
type default_bool = Default | true | false
type configuration_key = SuCommand | SuCommandQuoted | Interactive | Unknown
type configuration_key =
| SuCommand
| SuCommandQuoted
| Interactive
| Simulate
| Unknown
type main = {
su_command : string list;
su_command_quoted: default_bool;
interactive: bool
interactive: bool;
simulate: bool;
}
type configuration = { main : main; }
type input = { configuration: configuration; }
@ -53,6 +59,7 @@ let origin : schema = {
su_command = [ "su"; "-c" ];
su_command_quoted = Default;
interactive = true;
simulate = false;
};
};
};
@ -78,6 +85,7 @@ let string_of_key key =
| SuCommand -> "su_command"
| SuCommandQuoted -> "su_command_quoted"
| Interactive -> "interactive"
| Simulate -> "simulate"
| Unknown -> "<unknown key>"
let string_of_default_bool (b: default_bool): string =