X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=docs%2FGoalfile.pod;h=9031780dff73f15f229e7e45839b584eafa68a32;hb=6049de701cea350b3f474e4c1ff16836baa8e2fb;hp=40ca73a40f48f7383de6e5941576bd64b0041151;hpb=c3304e1ddf82ea319623c20a1d736d0cd743e377;p=goals.git diff --git a/docs/Goalfile.pod b/docs/Goalfile.pod index 40ca73a..9031780 100644 --- a/docs/Goalfile.pod +++ b/docs/Goalfile.pod @@ -30,6 +30,14 @@ For example: Returns the directory part of the path. +=head3 error (msg) + +For example: + + error ("this should not happen") + +This prints the error message and causes goals to exit. + =head3 extension (filename) For example: @@ -38,6 +46,32 @@ For example: Returns the filename extension. +=head3 filter (pattern, list) + +For example: + + filter ("a+", ["a", "b", "ca"]) ⇒ ["a", "ca"] + +Filter a list returning only the elements that match the extended +regular expression C. + +=head3 filter-out (pattern, list) + +For example: + + filter-out ("a+", ["a", "b", "ca"]) ⇒ ["b"] + +Filter a list returning only the elements that I match the +extended regular expression C. + +=head3 head (list) + +For example: + + head (["a", "b", "c"]) ⇒ "a" + +Returns the head (first) element of the list. + =head3 join (list1, list2) For example: @@ -48,6 +82,23 @@ Concatenate C and C. It's not usually necessary to use this function since goals automatically flattens lists within lists into simple lists in many cases. +=head3 read (filename) + +For example: + + read ("filename") => "this is the content of filename" + +Read the contents of C and return it as a single string. +If there is a trailing C<\n> in the file it is truncated. + +=head3 readlines (filename) + +For example: + + readlines ("filename") => ["line1", "line2", "line3"] + +Read the lines in C returning a list of strings. + =head3 realpath (filename) For example: @@ -76,6 +127,14 @@ This function works something like make’s C function, except that C is a regular expression, specifically a L extended regular expression. +=head3 tail (list) + +For example: + + tail (["a", "b", "c"]) ⇒ ["b", "c"] + +Returns the tail (all except first) elements of the list. + =head3 wildcard (pattern) For example: