package spin

  1. Overview
  2. Docs

Source file style.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
include Ansi

type t =
  { qmark_icon : string
  ; qmark_format : Ansi.style list
  ; message_format : Ansi.style list
  ; error_icon : string
  ; error_format : Ansi.style list
  ; default_format : Ansi.style list
  ; option_icon_marked : string
  ; option_icon_unmarked : string
  ; pointer_icon : string
  }

let default =
  { qmark_icon = "?"
  ; qmark_format = [ Ansi.green ]
  ; message_format = [ Ansi.bold ]
  ; error_icon = "X"
  ; error_format = [ Ansi.red; Ansi.bold ]
  ; default_format = []
  ; option_icon_marked = "○"
  ; option_icon_unmarked = "●"
  ; pointer_icon = "»"
  }

let make
    ?qmark_icon
    ?qmark_format
    ?message_format
    ?error_icon
    ?error_format
    ?default_format
    ?option_icon_marked
    ?option_icon_unmarked
    ?pointer_icon
    ()
  =
  let qmark_icon = Option.value qmark_icon ~default:default.qmark_icon in
  let qmark_format = Option.value qmark_format ~default:default.qmark_format in
  let message_format =
    Option.value message_format ~default:default.message_format
  in
  let error_icon = Option.value error_icon ~default:default.error_icon in
  let error_format = Option.value error_format ~default:default.error_format in
  let default_format =
    Option.value default_format ~default:default.default_format
  in
  let option_icon_marked =
    Option.value option_icon_marked ~default:default.option_icon_marked
  in
  let option_icon_unmarked =
    Option.value option_icon_unmarked ~default:default.option_icon_unmarked
  in
  let pointer_icon = Option.value pointer_icon ~default:default.pointer_icon in
  { qmark_icon
  ; qmark_format
  ; message_format
  ; error_icon
  ; error_format
  ; default_format
  ; option_icon_marked
  ; option_icon_unmarked
  ; pointer_icon
  }
OCaml

Innovation. Community. Security.