Implement -include (optional include) command.
[goals.git] / src / utils.mli
1 (* Goalfile utilities
2  * Copyright (C) 2019 Richard W.M. Jones
3  * Copyright (C) 2019 Red Hat Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *)
19
20 val failwithf : ('a, unit, string, 'b) format4 -> 'a
21 (** Like [failwith] but supports printf-like arguments. *)
22
23 val (//) : string -> string -> string
24 (** The {!Filename.concat} function. *)
25
26 val is_directory : string -> bool
27 (** Return true iff parameter is a directory. *)
28
29 val filter_map : ('a -> 'b option) -> 'a list -> 'b list
30 (** [filter_map f l] applies [f] to every element of [l], filters
31     out the [None] elements and returns the list of the arguments of
32     the [Some] elements. *)
33
34 val string_find : string -> string -> int
35 (** [string_find str sub] finds the index of [sub] in [str].  If
36     not found, returns -1. *)
37
38 val isspace : char -> bool
39 val triml : ?test:(char -> bool) -> string -> string
40 val trimr : ?test:(char -> bool) -> string -> string
41 val trim : ?test:(char -> bool) -> string -> string
42 (** Trim strings at left, right or both. *)
43
44 val absolute_path : string -> string
45 (** Convert any path into an absolute path. *)