open Stdune

module Diff : sig
  module Mode : sig
    type t =
      | Binary (** no diffing, just raw comparison *)
      | Text (** diffing after newline normalization *)

    val repr : t Repr.t
  end

  type nonrec ('path, 'target) t =
    { optional : bool
    ; mode : Mode.t
    ; directory_diffs : bool
    ; file1 : 'path
    ; file2 : 'target
    }

  val to_dyn : ('path -> Dyn.t) -> ('target -> Dyn.t) -> ('path, 'target) t -> Dyn.t
  val map : ('p, 't) t -> path:('p -> 'a) -> target:('t -> 'b) -> ('a, 'b) t
end

module Outputs : sig
  type t =
    | Stdout
    | Stderr
    | Outputs (** Both Stdout and Stderr *)

  val repr : t Repr.t
  val to_string : t -> string
end

module Inputs : sig
  type t = Stdin

  val repr : t Repr.t
  val to_string : t -> string
end

module File_perm : sig
  (** File mode, for when creating files. We only allow what Dune takes into
      account when memoizing commands. *)

  type t =
    | Normal
    | Executable

  val repr : t Repr.t
  val suffix : t -> string
  val to_unix_perm : t -> int
end
