package oui
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b806a63c9acd581a00729a48f1faf86b294cc82936fc705fc628a20ede33f977
sha512=e61c35a6e08671634c1edabd7b0add926ac6e0c6c43c9e0a095e89efab7696b6ae5cc1ea0844283a80640c19adb36478bdfb2414bbcab5077ceb7fd16ae45e66
doc/oui.lib/Oui/Sh_script/index.html
Module Oui.Sh_scriptSource
type 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"]