-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from quantifyearth/mwd-detect-subpaths-for-dirs
Detect subpaths for dirs
- Loading branch information
Showing
15 changed files
with
283 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
type t [@@deriving sexp] | ||
|
||
val v : name:string -> args:string list -> file_args:Fpath.t list -> t | ||
|
||
val pp : t Fmt.t | ||
(** A pretty printer for blocks. *) | ||
|
||
val of_string : string -> t option | ||
val name : t -> string | ||
val file_args : t -> Fpath.t list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
open Astring | ||
open Sexplib.Conv | ||
|
||
type path = Fpath.t | ||
|
||
let path_of_sexp = function | ||
| Ppx_sexp_conv_lib.Sexp.Atom s -> Fpath.v s | ||
| List _ -> Fpath.v "" | ||
|
||
let sexp_of_path v = Ppx_sexp_conv_lib.Sexp.Atom (Fpath.to_string v) | ||
|
||
type t = { id : int; path : path; subpath : string option; wildcard : bool } | ||
[@@deriving sexp] | ||
|
||
let pp ppf t = Sexplib.Sexp.pp_hum ppf (sexp_of_t t) | ||
|
||
let v ?subpath id path = | ||
let wildcard = | ||
match subpath with | ||
| None -> false | ||
| Some p -> Char.equal p.[String.length p - 1] '*' | ||
in | ||
if wildcard then { id; path; subpath = None; wildcard = true } | ||
else { id; path; subpath; wildcard = false } | ||
|
||
let id d = d.id | ||
let path d = d.path | ||
let subpath d = d.subpath | ||
let is_wildcard d = d.wildcard | ||
let compare a b = Int.compare a.id b.id | ||
let is_dir d = Fpath.is_dir_path d.path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(** A named file/directory that acts as an input and/or output of a process. *) | ||
|
||
type t [@@deriving sexp] | ||
|
||
val v : ?subpath:string -> int -> Fpath.t -> t | ||
(** Creates a new datafile with an integer ID and a file path. *) | ||
|
||
val pp : t Fmt.t | ||
(** A pretty printer for datafiles. *) | ||
|
||
val id : t -> int | ||
val path : t -> Fpath.t | ||
val subpath : t -> string option | ||
val is_wildcard : t -> bool | ||
val is_dir : t -> bool | ||
val compare : t -> t -> int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.