aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/world/file.lux
blob: 61ed8c379b7276e96f6a768a800ba19da81bf6ae (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
(.require
 [library
  [lux (.except)
   ["$" documentation]
   ["@" target]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" watch]])

(.def .public documentation
  (.List $.Module)
  (`` (`` ($.module /._
                    ""
                    [($.default /.async)
                     ($.default /.cannot_make_file)
                     ($.default /.cannot_find_file)
                     ($.default /.cannot_delete)
                     ($.default /.cannot_make_directory)
                     ($.default /.cannot_find_directory)
                     (,, (for @.lua (,, (these))
                              (,, (these ($.default /.default)))))

                     ($.documentation /.Path
                       "A path to a file or a directory in a file-system.")

                     ($.documentation (/.System !)
                       "An interface to a file-system.")

                     ($.documentation /.parent
                       "If a path represents a nested file/directory, extracts its parent directory."
                       [(parent fs path)])

                     ($.documentation /.name
                       "The un-nested name of a file/directory."
                       [(name fs path)])

                     ($.documentation /.rooted
                       "A nested path for a file/directory, given a root/parent path and a file/directory name within it."
                       [(rooted fs parent child)])

                     ($.documentation /.exists?
                       "Checks if either a file or a directory exists at the given path."
                       [(exists? monad fs path)])

                     ($.documentation /.mock
                       (format "A purely in-memory simulation of a file-system."
                               \n "Useful for testing.")
                       [(mock separator)])

                     ($.documentation /.make_directories
                       (format "Creates the directory specified by the given path."
                               \n "Also, creates every super-directory necessary to make the given path valid.")
                       [(make_directories monad fs path)])

                     ($.documentation /.make_file
                       "Creates a new file with the given content if-and-only-if the file does not already exist."
                       [(make_file monad fs content path)])]
                    [/watch.documentation]))))