aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/world/console.lux
blob: 8f5180287d510b98c59b15a48d8206338a621304 (plain)
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
(.require
 [library
  [lux (.except)
   ["$" documentation (.only documentation:)]
   ["@" target]
   [control
    ["<>" parser
     ["<[0]>" code]]]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]])

(documentation: (/.Console !)
  "An interface to console/terminal I/O.")

(documentation: /.write_line
  "Writes the message on the console and appends a new-line/line-feed at the end."
  [(write_line message console)])

(documentation: (/.Mock s)
  (format "A mock/simulation of a console."
          \n "Useful for testing."))

(documentation: /.mock
  ""
  [(mock mock init)])

(.def .public documentation
  (.List $.Module)
  (`` (`` ($.module /._
                    ""
                    [..Console
                     ..write_line
                     ..Mock
                     ..mock
                     ($.default /.async)
                     (~~ (for @.jvm (~~ (these ($.default /.cannot_open)
                                               ($.default /.cannot_close)
                                               ($.default /.default)))
                              (~~ (these))))]
                    []))))