Oui.Sh_scriptSourcetype command = | Continue| Return of int| Exit of int| Echo of string| Print_err of string| Eval of string| Eval_inplace of command| Shift| Assign of {}| Assign_eval of {var : string;command : command;}| Dirname of string| Mkdir of {}| Chmod of {}| Cp of {}| Rm of {}| Symlink of {}| Set_permissions_in of {on : find_type;permissions : int;starting_point : string;}| Copy_all_in of {}| If of {}| Prompt of {}| Case of {varname : string;cases : case list;}| While of {}| Write_file of {}| Read_file of {file : string;line_var : string;process_line : command list;}| Def_fun of {name : string;body : command list;}| Call_fun of {}Prints the given script using shell syntax to the given formatter. If version is set to true, a comment containing oui version and commit hash is printed as a comment in scripts.
assign ~var:"VAR" ~value:"value" is "VAR=\"value\""
echo fmt args is "echo \"s\"" where s is the expanded format string.
print_errf fmt args is "printf '%%s\\n' \"s\" >&2" where s is the expanded format string.
symlink ~target ~link is "ln -s target link"
if_ condition commands is "if [ condition ]; then commands fi"
set_permissions_in starting_point ~on ~permissions is "find starting_point -type find_type -exec chmod permissions {} +"
promt ~question ~varname is "printf \"question \"" followed by read varname.
while condition commands is "while [ condition ]; do commands done"
write_file file lines is "{ printf \"line1\n\"; printf \"line2\n\"; ... } > file". If append is set to true (default is false), append to file using ">>".
read_file ~line_var file process_line is "while IFS= read -r line_var || [ -n $line_var]; do \ process_line \ done < file"
call_fun name [arg1; arg2] is ["name arg1 arg2"]