Add unique ids to each Hack build, and handle sigint
[hiphop-php.git] / hphp / hack / src / utils / tty.mli
blobc140f8115e6658866c1473f0a58680eb9a345a4e
1 (**
2 * Copyright (c) 2014, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
9 *)
11 type raw_color =
12 | Default
13 | Black
14 | Red
15 | Green
16 | Yellow
17 | Blue
18 | Magenta
19 | Cyan
20 | White
22 type style =
23 | Normal of raw_color
24 | Bold of raw_color
25 | NormalWithBG of raw_color * raw_color
26 | BoldWithBG of raw_color * raw_color
28 type color_mode =
29 | Color_Always
30 | Color_Never
31 | Color_Auto
34 * Print a sequence of colorized strings to stdout, using ANSI color escapes
35 * codes.
37 val print : ?color_mode:color_mode -> (style * string) list -> unit
38 val printf : ?color_mode:color_mode -> style -> ('a, unit, string, unit) format4 -> 'a
40 (* These two functions provide a four-state TTY-friendly spinner that
41 * a client can output between sleeps if it happens to be waiting on
42 * a busy server (e.g. one that's initializing) *)
43 val spinner : unit -> string
44 val spinner_used : unit -> bool
46 (* Output a "clear current line" escape sequence to out_channel if it's
47 * a TTY and a newline otherwise *)
48 val print_clear_line : out_channel -> unit
50 (* Read a single char and return immediately, without waiting for a newline. *)
51 val read_char : unit -> char
53 (* Prompt the user to pick one character out of a given list. If other
54 * characters are entered, the prompt repeats indefinitely. *)
55 val read_choice : string -> char list -> char