Jai_Format module

format_find_config

procedureextensionsince 0.30.0Source

The settings for files in directory, from the nearest jacket.toml at or above it (up to stop), with read supplying file contents. file is the jacket.toml that was used, or "" for the defaults.

Example↗
reader :: (path: string) -> string, bool {
    if path == "/project/jacket.toml" return "[format]\nindent_width = 2\n", true;
    return "", false;
}

config, file, ok := format_find_config("/project/src", reader);
assert(ok && file == "/project/jacket.toml" && config.indent_width == 2);
format_find_config :: (
    directory: string,
    read: Format_File_Reader,
    stop := ""
) -> (config: Format_Config, file: string, ok: bool, error: string)

Parameters

directory: string
stop := ""

Returns

file: string
ok: bool
error: string

See also