globsFileReader

Parse mime/globs file by line ignoring empty lines and comments.

globsFileReader
(
Range
)
(
Range byLine
)
if (
isInputRange!Range &&
is(ElementType!Range : string)
)

Return Value

Type: auto

Range of GlobLine tuples.

Throws

Examples

string[] lines = ["#comment", "text/x-c++src:*.cpp", "text/x-csrc:*.c"];
auto expected = [GlobLine(defaultGlobWeight, "text/x-c++src", "*.cpp", false), GlobLine(defaultGlobWeight, "text/x-csrc", "*.c", false)];
assert(equal(globsFileReader(lines), expected));
assert(equal(globsFileReader(["text/plain:__NOGLOBS__"]), [GlobLine(0, "text/plain", "__NOGLOBS__", false)]));

assertThrown!MimeFileException(globsFileReader(["#comment", "text/plain:*.txt", "nocolon"]).array, "must throw");

Meta