|
| 1 | + |
| 2 | + |
| 3 | +// Module: Fs |
| 4 | +// Functions for interacting with the filesystem |
| 5 | +Fs :: module { |
| 6 | + |
| 7 | + // Function: readToString |
| 8 | + // Reads the path to a string |
| 9 | + // |
| 10 | + // Parameters: |
| 11 | + // path - (String) The path to read from |
| 12 | + // |
| 13 | + // Returns: |
| 14 | + // Tuple - The tuple representing a success or an error |
| 15 | + // --Code: |
| 16 | + // (true, ()) // Represents a success value |
| 17 | + // ((), err) // Represents an error value |
| 18 | + // -- |
| 19 | + // |
| 20 | + readToString :: (path) = pic_nat_readtostring(path) |
| 21 | + |
| 22 | + // Function: readToFileString |
| 23 | + // Reads the file to a string |
| 24 | + // |
| 25 | + // Parameters: |
| 26 | + // file - (Object) The path to read from |
| 27 | + // |
| 28 | + // Returns: |
| 29 | + // Tuple - The tuple representing a success or an error |
| 30 | + // --Code: |
| 31 | + // (true, ()) // Represents a success value |
| 32 | + // ((), err) // Represents an error value |
| 33 | + // -- |
| 34 | + // |
| 35 | + readFileToString :: (file) = pic_nat_readfiletostring(file) |
| 36 | + |
| 37 | + |
| 38 | + // Function: writeLine |
| 39 | + // Write the line to the file represented by the path |
| 40 | + // |
| 41 | + // Parameters: |
| 42 | + // path - (Object) The path to write to |
| 43 | + // line - (String) The line to write |
| 44 | + // |
| 45 | + // Returns: |
| 46 | + // Tuple - The tuple representing a success or an error |
| 47 | + // --Code: |
| 48 | + // (true, ()) // Represents a success value |
| 49 | + // ((), err) // Represents an error value |
| 50 | + // -- |
| 51 | + // |
| 52 | + writeLine :: (path, line) = pic_nat_writeline(path, line) |
| 53 | + |
| 54 | + |
| 55 | + // Function: writeLines |
| 56 | + // Write the line to the file represented by the path |
| 57 | + // |
| 58 | + // Parameters: |
| 59 | + // path - (Object) The path to write to |
| 60 | + // lines - (Array) The lines to write |
| 61 | + // |
| 62 | + // Returns: |
| 63 | + // Tuple - The tuple representing a success or an error |
| 64 | + // --Code: |
| 65 | + // (true, ()) // Represents a success value |
| 66 | + // ((), err) // Represents an error value |
| 67 | + // -- |
| 68 | + // |
| 69 | + writeLines :: (path, lines=[]) = pic_nat_writelines(path, lines) |
| 70 | + |
| 71 | + |
| 72 | + // Function: appendLine |
| 73 | + // Append the line to the file represented by the path |
| 74 | + // |
| 75 | + // Parameters: |
| 76 | + // path - (Object) The path to write to |
| 77 | + // line - (String) The lines to write |
| 78 | + // |
| 79 | + // Returns: |
| 80 | + // Tuple - The tuple representing a success or an error |
| 81 | + // --Code: |
| 82 | + // (true, ()) // Represents a success value |
| 83 | + // ((), err) // Represents an error value |
| 84 | + // -- |
| 85 | + // |
| 86 | + appendLine :: (path, line) = pic_nat_appendline(path, line) |
| 87 | + |
| 88 | + |
| 89 | + // Function: appendLines |
| 90 | + // Write the line to the file represented by the path |
| 91 | + // |
| 92 | + // Parameters: |
| 93 | + // path - (Object) The path to write to |
| 94 | + // lines - (Array) The lines to write |
| 95 | + // |
| 96 | + // Returns: |
| 97 | + // Tuple - The tuple representing a success or an error |
| 98 | + // --Code: |
| 99 | + // (true, ()) // Represents a success value |
| 100 | + // ((), err) // Represents an error value |
| 101 | + // -- |
| 102 | + // |
| 103 | + appendLines :: (path, lines=[]) = pic_nat_appendlines(path, lines) |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + // Function: writeLineToFile |
| 108 | + // Write the line to the file object |
| 109 | + // |
| 110 | + // Parameters: |
| 111 | + // file - (File) The file to write to |
| 112 | + // line - (String) The line to write |
| 113 | + // |
| 114 | + // Returns: |
| 115 | + // Tuple - The tuple representing a success or an error |
| 116 | + // --Code: |
| 117 | + // (true, ()) // Represents a success value |
| 118 | + // ((), err) // Represents an error value |
| 119 | + // -- |
| 120 | + // |
| 121 | + writeLineToFile :: (file, line) = pic_nat_writelinetofile(file, line) |
| 122 | + |
| 123 | + |
| 124 | + // Function: writeLinesToFile |
| 125 | + // Write the line to the file object |
| 126 | + // |
| 127 | + // Parameters: |
| 128 | + // file - (File) The file to write to |
| 129 | + // lines - (Array) The lines to write |
| 130 | + // |
| 131 | + // Returns: |
| 132 | + // Tuple - The tuple representing a success or an error |
| 133 | + // --Code: |
| 134 | + // (true, ()) // Represents a success value |
| 135 | + // ((), err) // Represents an error value |
| 136 | + // -- |
| 137 | + // |
| 138 | + writeLinesToFile :: (file, lines) = pic_nat_writelinestofile(file, lines) |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + // Function: appendLineToFile |
| 143 | + // Append the line to the file |
| 144 | + // |
| 145 | + // Parameters: |
| 146 | + // file - (File) The file to write to |
| 147 | + // line - (String) The lines to write |
| 148 | + // |
| 149 | + // Returns: |
| 150 | + // Tuple - The tuple representing a success or an error |
| 151 | + // --Code: |
| 152 | + // (true, ()) // Represents a success value |
| 153 | + // ((), err) // Represents an error value |
| 154 | + // -- |
| 155 | + // |
| 156 | + appendLineToFile :: (file, line) = pic_nat_appendlinetofile(file, line) |
| 157 | + |
| 158 | + |
| 159 | + // Function: appendLinesToFile |
| 160 | + // Write the line to the file |
| 161 | + // |
| 162 | + // Parameters: |
| 163 | + // file - (File) The file to write to |
| 164 | + // lines - (Array) The lines to write |
| 165 | + // |
| 166 | + // Returns: |
| 167 | + // Tuple - The tuple representing a success or an error |
| 168 | + // --Code: |
| 169 | + // (str, ()) // Represents a success value |
| 170 | + // ((), err) // Represents an error value |
| 171 | + // -- |
| 172 | + // |
| 173 | + appendLinesToFile :: (file, lines=[]) = pic_nat_appendlinestofile(file, lines) |
| 174 | + |
| 175 | + |
| 176 | + // Function: getContext |
| 177 | + // Get the context for the filesystem |
| 178 | + // |
| 179 | + // Parameters: |
| 180 | + // path - (String) The path to create a context for |
| 181 | + // |
| 182 | + // Returns: |
| 183 | + // (Object) - The context as an object |
| 184 | + // |
| 185 | + getContext :: (path) = pic_nat_getcontext(path) |
| 186 | + |
| 187 | + |
| 188 | + // Function: getFileContext |
| 189 | + // Get the context for the filesystem from a file object |
| 190 | + // |
| 191 | + // Parameters: |
| 192 | + // file - (File) The file to create a context for |
| 193 | + // |
| 194 | + // Returns: |
| 195 | + // (Object) - The context as an object |
| 196 | + // |
| 197 | + getFileContext :: (file) = pic_nat_getfilecontext(file) |
| 198 | + |
| 199 | + |
| 200 | + // Function: cd |
| 201 | + // Change the directory |
| 202 | + // |
| 203 | + // Parameters: |
| 204 | + // ctx - (Object) The context object |
| 205 | + // path - (String) The path to change to |
| 206 | + // |
| 207 | + // Returns: |
| 208 | + // (Object) - The context as an object |
| 209 | + // |
| 210 | + cd :: (ctx, path) = pic_nat_cd(ctx, path) |
| 211 | + |
| 212 | + |
| 213 | + // Function: ls |
| 214 | + // Change the directory |
| 215 | + // |
| 216 | + // Parameters: |
| 217 | + // ctx - (Object) The context object |
| 218 | + // path - (String) The path to change to |
| 219 | + // |
| 220 | + // Returns: |
| 221 | + // (Object) - The context as an object |
| 222 | + // |
| 223 | + ls :: (ctx, path=".") = pic_nat_ls(ctx, path) |
| 224 | + |
| 225 | + |
| 226 | + // Function: getPwd |
| 227 | + // Gets the current working directory |
| 228 | + // |
| 229 | + // Parameters: |
| 230 | + // ctx - (Object) The context object |
| 231 | + // |
| 232 | + // Returns: |
| 233 | + // (String) - The current working directory |
| 234 | + // |
| 235 | + getPwd :: (ctx) = pic_nat_pwd(ctx) |
| 236 | +} |
| 237 | + |
| 238 | + |
0 commit comments