5 Goalfile - introduction, tutorial, and reference for writing goal files
15 =head2 Standard Functions
17 =head3 basename (path)
21 basename ("dir/file.ext") ⇒ "file.ext"
23 Returns the filename part of the path.
29 dirname ("dir/file.ext") ⇒ "dir"
31 Returns the directory part of the path.
33 =head3 extension (filename)
37 extension ("dir/file.ext") ⇒ "ext"
39 Returns the filename extension.
41 =head3 join (list1, list2)
45 join (["a", "b"], ["c", "d"]) ⇒ ["a", "b", "c", "d"]
47 Concatenate C<list1> and C<list2>. It's not usually necessary to use
48 this function since goals automatically flattens lists within lists
49 into simple lists in many cases.
55 sort (["c", "b", "b", "a"]) ⇒ ["a", "b", "c"]
57 This takes a list of strings and sorts it, removing duplicates.
59 =head3 subst (from, to, text)
63 subst ("aa", "AA", "aabbccaa") ⇒ "AAbbccAA"
64 subst ("a.*c", "b", "aaacac") ⇒ "bb"
66 This function works something like make’s C<subst> function, except
67 that C<from> is a regular expression, specifically a L<sed(1)>
68 extended regular expression.
70 =head3 wildcard (pattern)
74 wildcard ("*.c") ⇒ ["bar.c", "foo.c"]
76 The single parameter is a wildcard which is expanded into a list of
77 files using ordinary globbing rules.
79 =head3 wrap (wrapper, list)
83 wrap ("*file", ["bar.c", "foo.c"]) ⇒ [*file("bar.c"), *file("foo.c")]
85 Each element in C<list> is wrapped into a call to C<wrapper(element)>.
86 There are two common uses for this: either to add explicit tactics
87 (such as C<*file>) to a plain list of strings as in the example above;
88 or to turn a list of strings into a list of goal or function calls.
96 Richard W.M. Jones <rjones@redhat.com>
100 Copyright (C) 2020 Richard W.M. Jones
102 Copyright (C) 2020 Red Hat Inc.
104 This program is free software; you can redistribute it and/or modify
105 it under the terms of the GNU General Public License as published by
106 the Free Software Foundation; either version 2 of the License, or
107 (at your option) any later version.
109 This program is distributed in the hope that it will be useful,
110 but WITHOUT ANY WARRANTY; without even the implied warranty of
111 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112 GNU General Public License for more details.
114 You should have received a copy of the GNU General Public License along
115 with this program; if not, write to the Free Software Foundation, Inc.,
116 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.