@shd101wyy/yo 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/out/cjs/index.cjs +578 -572
- package/out/cjs/yo-cli.cjs +1413 -592
- package/out/esm/index.mjs +434 -428
- package/out/types/src/build-runner.d.ts +1 -1
- package/out/types/src/doc/builder.d.ts +21 -0
- package/out/types/src/doc/builder.test.d.ts +1 -0
- package/out/types/src/doc/extractor.d.ts +27 -0
- package/out/types/src/doc/extractor.test.d.ts +1 -0
- package/out/types/src/doc/model.d.ts +87 -0
- package/out/types/src/doc/render-html.d.ts +23 -0
- package/out/types/src/doc/render-html.test.d.ts +1 -0
- package/out/types/src/doc/render-json.d.ts +7 -0
- package/out/types/src/doc/render-json.test.d.ts +1 -0
- package/out/types/src/doc/render-markdown.d.ts +13 -0
- package/out/types/src/doc/render-markdown.test.d.ts +1 -0
- package/out/types/src/doc/sections.d.ts +7 -0
- package/out/types/src/doc/sections.test.d.ts +1 -0
- package/out/types/src/doc-command.d.ts +10 -0
- package/out/types/src/env.d.ts +1 -0
- package/out/types/src/evaluator/builtins/build.d.ts +17 -0
- package/out/types/src/evaluator/context.d.ts +1 -0
- package/out/types/src/expr.d.ts +2 -1
- package/out/types/src/token.d.ts +4 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/scripts/build-site.ts +461 -0
- package/std/alg/hash.yo +12 -24
- package/std/allocator.yo +21 -29
- package/std/async.yo +4 -2
- package/std/build.yo +188 -42
- package/std/cli/arg_parser.yo +37 -1
- package/std/collections/array_list.yo +8 -20
- package/std/collections/btree_map.yo +15 -20
- package/std/collections/deque.yo +13 -15
- package/std/collections/hash_map.yo +15 -54
- package/std/collections/hash_set.yo +14 -50
- package/std/collections/linked_list.yo +6 -23
- package/std/collections/priority_queue.yo +15 -17
- package/std/crypto/md5.yo +10 -9
- package/std/crypto/random.yo +14 -12
- package/std/crypto/sha256.yo +9 -8
- package/std/encoding/base64.yo +13 -15
- package/std/encoding/hex.yo +14 -10
- package/std/encoding/html.yo +14 -11
- package/std/encoding/html_char_utils.yo +14 -11
- package/std/encoding/html_entities.yo +7 -8
- package/std/encoding/json.yo +36 -19
- package/std/encoding/punycode.yo +21 -18
- package/std/encoding/toml.yo +23 -9
- package/std/encoding/utf16.yo +16 -9
- package/std/error.yo +10 -23
- package/std/fmt/display.yo +15 -17
- package/std/fmt/index.yo +6 -27
- package/std/fmt/to_string.yo +4 -10
- package/std/fmt/writer.yo +33 -34
- package/std/fs/dir.yo +37 -30
- package/std/fs/file.yo +77 -75
- package/std/fs/metadata.yo +25 -25
- package/std/fs/temp.yo +21 -27
- package/std/fs/types.yo +20 -23
- package/std/fs/walker.yo +26 -31
- package/std/gc.yo +5 -0
- package/std/glob/index.yo +3 -0
- package/std/http/client.yo +25 -11
- package/std/http/http.yo +20 -0
- package/std/http/index.yo +1 -0
- package/std/io/reader.yo +4 -8
- package/std/io/writer.yo +4 -7
- package/std/libc/assert.yo +2 -2
- package/std/libc/ctype.yo +1 -2
- package/std/libc/dirent.yo +1 -2
- package/std/libc/errno.yo +1 -2
- package/std/libc/fcntl.yo +2 -2
- package/std/libc/float.yo +1 -2
- package/std/libc/limits.yo +1 -2
- package/std/libc/math.yo +2 -0
- package/std/libc/signal.yo +1 -2
- package/std/libc/stdatomic.yo +1 -2
- package/std/libc/stdint.yo +4 -3
- package/std/libc/stdio.yo +2 -0
- package/std/libc/stdlib.yo +2 -0
- package/std/libc/string.yo +2 -0
- package/std/libc/sys/stat.yo +1 -2
- package/std/libc/time.yo +2 -2
- package/std/libc/unistd.yo +2 -0
- package/std/libc/wctype.yo +1 -2
- package/std/libc/windows.yo +2 -2
- package/std/log/index.yo +11 -26
- package/std/net/addr.yo +18 -11
- package/std/net/dns.yo +3 -2
- package/std/net/errors.yo +16 -2
- package/std/net/tcp.yo +25 -22
- package/std/net/udp.yo +14 -12
- package/std/os/env.yo +23 -18
- package/std/os/signal.yo +31 -19
- package/std/path.yo +23 -74
- package/std/prelude.yo +284 -113
- package/std/process.yo +23 -37
- package/std/regex/compiler.yo +3 -5
- package/std/regex/flags.yo +11 -11
- package/std/regex/index.yo +2 -13
- package/std/regex/match.yo +3 -5
- package/std/regex/node.yo +6 -6
- package/std/regex/parser.yo +2 -4
- package/std/regex/unicode.yo +5 -5
- package/std/regex/vm.yo +5 -5
- package/std/string/index.yo +2 -1
- package/std/string/rune.yo +25 -1
- package/std/string/string.yo +31 -19
- package/std/string/unicode.yo +14 -15
- package/std/sync/channel.yo +18 -28
- package/std/sync/cond.yo +4 -0
- package/std/sync/mutex.yo +4 -1
- package/std/sync/once.yo +17 -19
- package/std/sync/rwlock.yo +19 -22
- package/std/sync/waitgroup.yo +21 -23
- package/std/sys/advise.yo +4 -4
- package/std/sys/bufio/buf_reader.yo +19 -16
- package/std/sys/bufio/buf_writer.yo +14 -11
- package/std/sys/clock.yo +4 -4
- package/std/sys/constants.yo +5 -5
- package/std/sys/copy.yo +9 -8
- package/std/sys/dir.yo +9 -8
- package/std/sys/dns.yo +8 -8
- package/std/sys/errors.yo +35 -6
- package/std/sys/events.yo +3 -3
- package/std/sys/externs.yo +3 -3
- package/std/sys/fallocate.yo +4 -4
- package/std/sys/fcntl.yo +8 -6
- package/std/sys/file.yo +7 -8
- package/std/sys/future.yo +1 -3
- package/std/sys/iov.yo +4 -4
- package/std/sys/lock.yo +7 -7
- package/std/sys/mmap.yo +7 -8
- package/std/sys/path.yo +4 -7
- package/std/sys/perm.yo +8 -8
- package/std/sys/pipe.yo +9 -8
- package/std/sys/process.yo +8 -8
- package/std/sys/seek.yo +4 -4
- package/std/sys/signal.yo +4 -4
- package/std/sys/signals.yo +4 -4
- package/std/sys/socket.yo +4 -4
- package/std/sys/socketpair.yo +4 -4
- package/std/sys/sockinfo.yo +4 -4
- package/std/sys/statfs.yo +8 -8
- package/std/sys/statx.yo +4 -4
- package/std/sys/sysinfo.yo +4 -4
- package/std/sys/tcp.yo +8 -8
- package/std/sys/temp.yo +9 -8
- package/std/sys/time.yo +8 -8
- package/std/sys/timer.yo +7 -8
- package/std/sys/tty.yo +13 -10
- package/std/sys/udp.yo +8 -8
- package/std/sys/umask.yo +4 -4
- package/std/sys/unix.yo +5 -5
- package/std/testing/bench.yo +21 -10
- package/std/thread.yo +18 -9
- package/std/time/datetime.yo +12 -14
- package/std/time/duration.yo +12 -14
- package/std/time/instant.yo +13 -16
- package/std/time/sleep.yo +9 -8
- package/std/url/index.yo +3 -19
- package/std/worker.yo +10 -18
package/std/fmt/writer.yo
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
//! Chainable string builder for composing formatted output.
|
|
2
|
+
//!
|
|
3
|
+
//! # Example
|
|
4
|
+
//!
|
|
5
|
+
//! ```rust
|
|
6
|
+
//! { Writer, Alignment } :: import "std/fmt/writer";
|
|
7
|
+
//!
|
|
8
|
+
//! w := Writer.new()
|
|
9
|
+
//! .write_str("hello ")
|
|
10
|
+
//! .write_str("world")
|
|
11
|
+
//! .write_byte(u8(33));
|
|
12
|
+
//! s := w.to_string(); // "hello world!"
|
|
13
|
+
//! ```
|
|
14
14
|
|
|
15
15
|
{ String } :: import "../string";
|
|
16
16
|
{ ArrayList } :: import "../collections/array_list";
|
|
17
17
|
{ rune } :: import "../string/rune";
|
|
18
18
|
{ snprintf } :: import "../libc/stdio";
|
|
19
19
|
|
|
20
|
+
/// Text alignment for padded output.
|
|
20
21
|
Alignment :: enum(Left, Right, Center);
|
|
21
22
|
export Alignment;
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// ============================================================================
|
|
26
|
-
|
|
24
|
+
/// Chainable string builder backed by `ArrayList(u8)`.
|
|
25
|
+
/// Useful for constructing formatted strings without intermediate allocations.
|
|
27
26
|
Writer :: object(
|
|
28
27
|
buf : ArrayList(u8)
|
|
29
28
|
);
|
|
30
29
|
|
|
31
30
|
impl(Writer,
|
|
32
|
-
|
|
31
|
+
/// Create a new empty Writer.
|
|
33
32
|
new : (fn() -> Self)(
|
|
34
33
|
Self(buf: ArrayList(u8).new())
|
|
35
34
|
),
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
/// Create a Writer pre-allocated with the given byte capacity.
|
|
38
37
|
with_capacity : (fn(cap: usize) -> Self)(
|
|
39
38
|
Self(buf: ArrayList(u8).with_capacity(cap))
|
|
40
39
|
),
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
/// Append a `str` literal (byte slice) to the Writer.
|
|
43
42
|
write_str : (fn(self: Self, s: str) -> Self)({
|
|
44
43
|
i := usize(0);
|
|
45
44
|
while (i < s.len()),
|
|
@@ -50,7 +49,7 @@ impl(Writer,
|
|
|
50
49
|
self
|
|
51
50
|
}),
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
/// Append a String (owned UTF-8) to the Writer.
|
|
54
53
|
write_string : (fn(self: Self, s: String) -> Self)({
|
|
55
54
|
bytes := s.as_bytes();
|
|
56
55
|
i := usize(0);
|
|
@@ -62,13 +61,13 @@ impl(Writer,
|
|
|
62
61
|
self
|
|
63
62
|
}),
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
/// Append a single byte to the Writer.
|
|
66
65
|
write_byte : (fn(self: Self, b: u8) -> Self)({
|
|
67
66
|
self.buf.push(b);
|
|
68
67
|
self
|
|
69
68
|
}),
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
/// Append an ArrayList(u8) of bytes to the Writer.
|
|
72
71
|
write_bytes : (fn(self: Self, data: ArrayList(u8)) -> Self)({
|
|
73
72
|
i := usize(0);
|
|
74
73
|
while (i < data.len()),
|
|
@@ -79,7 +78,7 @@ impl(Writer,
|
|
|
79
78
|
self
|
|
80
79
|
}),
|
|
81
80
|
|
|
82
|
-
|
|
81
|
+
/// Append a Unicode code point encoded as UTF-8.
|
|
83
82
|
write_rune : (fn(self: Self, r: rune) -> Self)({
|
|
84
83
|
v := u32(r.char);
|
|
85
84
|
cond(
|
|
@@ -105,7 +104,7 @@ impl(Writer,
|
|
|
105
104
|
self
|
|
106
105
|
}),
|
|
107
106
|
|
|
108
|
-
|
|
107
|
+
/// Append a signed 64-bit integer in decimal.
|
|
109
108
|
write_i64 : (fn(self: Self, n: i64) -> Self)({
|
|
110
109
|
buf := Array(u8, usize(24)).fill(u8(0));
|
|
111
110
|
buf_ptr := &(buf(usize(0)));
|
|
@@ -114,7 +113,7 @@ impl(Writer,
|
|
|
114
113
|
self.write_string(s)
|
|
115
114
|
}),
|
|
116
115
|
|
|
117
|
-
|
|
116
|
+
/// Append an unsigned 64-bit integer in decimal.
|
|
118
117
|
write_u64 : (fn(self: Self, n: u64) -> Self)({
|
|
119
118
|
buf := Array(u8, usize(24)).fill(u8(0));
|
|
120
119
|
buf_ptr := &(buf(usize(0)));
|
|
@@ -123,7 +122,7 @@ impl(Writer,
|
|
|
123
122
|
self.write_string(s)
|
|
124
123
|
}),
|
|
125
124
|
|
|
126
|
-
|
|
125
|
+
/// Append a 64-bit float with the given number of decimal places.
|
|
127
126
|
write_f64 : (fn(self: Self, n: f64, precision: i32) -> Self)({
|
|
128
127
|
buf := Array(u8, usize(64)).fill(u8(0));
|
|
129
128
|
buf_ptr := &(buf(usize(0)));
|
|
@@ -132,7 +131,7 @@ impl(Writer,
|
|
|
132
131
|
self.write_string(s)
|
|
133
132
|
}),
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
/// Append a bool as "true" or "false".
|
|
136
135
|
write_bool : (fn(self: Self, b: bool) -> Self)(
|
|
137
136
|
cond(
|
|
138
137
|
b => self.write_str("true"),
|
|
@@ -140,7 +139,7 @@ impl(Writer,
|
|
|
140
139
|
)
|
|
141
140
|
),
|
|
142
141
|
|
|
143
|
-
|
|
142
|
+
/// Append an unsigned 64-bit integer in lowercase hexadecimal.
|
|
144
143
|
write_hex : (fn(self: Self, n: u64) -> Self)({
|
|
145
144
|
buf := Array(u8, usize(20)).fill(u8(0));
|
|
146
145
|
buf_ptr := &(buf(usize(0)));
|
|
@@ -149,7 +148,7 @@ impl(Writer,
|
|
|
149
148
|
self.write_string(s)
|
|
150
149
|
}),
|
|
151
150
|
|
|
152
|
-
|
|
151
|
+
/// Append an unsigned 64-bit integer in octal.
|
|
153
152
|
write_octal : (fn(self: Self, n: u64) -> Self)({
|
|
154
153
|
buf := Array(u8, usize(24)).fill(u8(0));
|
|
155
154
|
buf_ptr := &(buf(usize(0)));
|
|
@@ -158,7 +157,7 @@ impl(Writer,
|
|
|
158
157
|
self.write_string(s)
|
|
159
158
|
}),
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
/// Append an unsigned 64-bit integer in binary (no stdlib support — manual).
|
|
162
161
|
write_binary : (fn(self: Self, n: u64) -> Self)({
|
|
163
162
|
cond(
|
|
164
163
|
(n == u64(0)) => {
|
|
@@ -186,7 +185,7 @@ impl(Writer,
|
|
|
186
185
|
self
|
|
187
186
|
}),
|
|
188
187
|
|
|
189
|
-
|
|
188
|
+
/// Append a str padded to width using the given pad rune and alignment.
|
|
190
189
|
write_padded : (fn(self: Self, s: str, width: usize, pad: rune, align: Alignment) -> Self)({
|
|
191
190
|
len := s.len();
|
|
192
191
|
cond(
|
|
@@ -227,12 +226,12 @@ impl(Writer,
|
|
|
227
226
|
)
|
|
228
227
|
}),
|
|
229
228
|
|
|
230
|
-
|
|
229
|
+
/// Consume the Writer and return an owned String.
|
|
231
230
|
to_string : (fn(self: Self) -> String)(
|
|
232
231
|
String.from_bytes(self.buf)
|
|
233
232
|
),
|
|
234
233
|
|
|
235
|
-
|
|
234
|
+
/// Return the current byte length of the buffer.
|
|
236
235
|
len : (fn(self: Self) -> usize)(
|
|
237
236
|
self.buf.len()
|
|
238
237
|
)
|
package/std/fs/dir.yo
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
//! Async directory operations — create, remove, read, link, rename.
|
|
2
|
+
//!
|
|
3
|
+
//! Wraps low-level `std/sys/dir` with typed APIs using the `Exception` effect.
|
|
4
|
+
//!
|
|
5
|
+
//! Example:
|
|
6
|
+
//! { create_dir, remove_dir, read_dir } :: import "std/fs/dir";
|
|
7
|
+
//! { Path } :: import "std/path";
|
|
8
|
+
//!
|
|
9
|
+
//! main :: (fn(using(io : IO)) -> unit)({
|
|
10
|
+
//! given(exn) : Exception = {
|
|
11
|
+
//! throw : (fn(forall(T : Type), error: AnyError) -> T)(
|
|
12
|
+
//! { println(error.to_string()); exit(i32(1)); }
|
|
13
|
+
//! )
|
|
14
|
+
//! };
|
|
15
|
+
//!
|
|
16
|
+
//! io.await(create_dir(Path.new(`/tmp/yo_test`)));
|
|
17
|
+
//! entries := io.await(read_dir(Path.new(`/tmp/yo_test`)));
|
|
18
|
+
//! io.await(remove_dir(Path.new(`/tmp/yo_test`)));
|
|
19
|
+
//! });
|
|
20
20
|
|
|
21
21
|
{ GlobalAllocator } :: import "../allocator";
|
|
22
22
|
{ malloc, free } :: GlobalAllocator;
|
|
@@ -39,10 +39,15 @@ IO_file :: import "../sys/file";
|
|
|
39
39
|
// FileType enum
|
|
40
40
|
// ============================================================================
|
|
41
41
|
|
|
42
|
+
/// The type of a file system entry.
|
|
42
43
|
FileType :: enum(
|
|
44
|
+
/// A regular file.
|
|
43
45
|
File,
|
|
46
|
+
/// A directory.
|
|
44
47
|
Directory,
|
|
48
|
+
/// A symbolic link.
|
|
45
49
|
Symlink,
|
|
50
|
+
/// An unknown or unsupported file type.
|
|
46
51
|
Other
|
|
47
52
|
);
|
|
48
53
|
|
|
@@ -52,6 +57,7 @@ export FileType;
|
|
|
52
57
|
// DirEntry
|
|
53
58
|
// ============================================================================
|
|
54
59
|
|
|
60
|
+
/// A directory entry containing the entry name, file type, and inode number.
|
|
55
61
|
DirEntry :: struct(
|
|
56
62
|
name : String,
|
|
57
63
|
file_type : FileType,
|
|
@@ -64,7 +70,7 @@ export DirEntry;
|
|
|
64
70
|
// Directory operations
|
|
65
71
|
// ============================================================================
|
|
66
72
|
|
|
67
|
-
|
|
73
|
+
/// Create a directory at the given path.
|
|
68
74
|
create_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
69
75
|
io.async((using(io, exn)) => {
|
|
70
76
|
cstr_bytes := path.to_string().to_cstr();
|
|
@@ -77,13 +83,13 @@ create_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception
|
|
|
77
83
|
})
|
|
78
84
|
);
|
|
79
85
|
|
|
80
|
-
|
|
86
|
+
/// Create a directory (`str` path variant).
|
|
81
87
|
create_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
82
88
|
create_dir(Path.new(String.from(path)))
|
|
83
89
|
);
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
/// Create a directory and all missing parent directories.
|
|
92
|
+
/// Does not error if the directory already exists.
|
|
87
93
|
create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
88
94
|
io.async((using(io, exn)) => {
|
|
89
95
|
path_s := path.to_string();
|
|
@@ -160,12 +166,12 @@ create_dir_all :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Excep
|
|
|
160
166
|
})
|
|
161
167
|
);
|
|
162
168
|
|
|
163
|
-
|
|
169
|
+
/// Create a directory and all missing parents (`str` path variant).
|
|
164
170
|
create_dir_all_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
165
171
|
create_dir_all(Path.new(String.from(path)))
|
|
166
172
|
);
|
|
167
173
|
|
|
168
|
-
|
|
174
|
+
/// Remove an empty directory. Throws if the directory is not empty.
|
|
169
175
|
remove_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
170
176
|
io.async((using(io, exn)) => {
|
|
171
177
|
cstr_bytes := path.to_string().to_cstr();
|
|
@@ -182,7 +188,7 @@ remove_dir_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Except
|
|
|
182
188
|
remove_dir(Path.new(String.from(path)))
|
|
183
189
|
);
|
|
184
190
|
|
|
185
|
-
|
|
191
|
+
/// Remove a file at the given path.
|
|
186
192
|
remove_file :: (fn(path: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
187
193
|
io.async((using(io, exn)) => {
|
|
188
194
|
cstr_bytes := path.to_string().to_cstr();
|
|
@@ -199,7 +205,7 @@ remove_file_str :: (fn(path: str, using(io : IO)) -> Impl(Future(unit, IO, Excep
|
|
|
199
205
|
remove_file(Path.new(String.from(path)))
|
|
200
206
|
;
|
|
201
207
|
|
|
202
|
-
|
|
208
|
+
/// Rename or move a file or directory from `from` to `to`.
|
|
203
209
|
rename :: (fn(from: Path, to: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
204
210
|
io.async((using(io, exn)) => {
|
|
205
211
|
from_cstr_bytes := from.to_string().to_cstr();
|
|
@@ -218,7 +224,7 @@ rename_str :: (fn(from: str, to: str, using(io : IO)) -> Impl(Future(unit, IO, E
|
|
|
218
224
|
rename(Path.new(String.from(from)), Path.new(String.from(to)))
|
|
219
225
|
;
|
|
220
226
|
|
|
221
|
-
|
|
227
|
+
/// Create a hard link from `src` to `dst`.
|
|
222
228
|
hard_link :: (fn(src: Path, dst: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
223
229
|
io.async((using(io, exn)) => {
|
|
224
230
|
src_cstr_bytes := src.to_string().to_cstr();
|
|
@@ -237,7 +243,7 @@ hard_link_str :: (fn(src: str, dst: str, using(io : IO)) -> Impl(Future(unit, IO
|
|
|
237
243
|
hard_link(Path.new(String.from(src)), Path.new(String.from(dst)))
|
|
238
244
|
;
|
|
239
245
|
|
|
240
|
-
|
|
246
|
+
/// Create a symbolic link at `dst` pointing to `src`.
|
|
241
247
|
symlink :: (fn(src: Path, dst: Path, using(io : IO)) -> Impl(Future(unit, IO, Exception)))(
|
|
242
248
|
io.async((using(io, exn)) => {
|
|
243
249
|
src_cstr_bytes := src.to_string().to_cstr();
|
|
@@ -260,7 +266,8 @@ symlink_str :: (fn(src: str, dst: str, using(io : IO)) -> Impl(Future(unit, IO,
|
|
|
260
266
|
// Directory listing
|
|
261
267
|
// ============================================================================
|
|
262
268
|
|
|
263
|
-
|
|
269
|
+
/// Read all entries from a directory, returning an `ArrayList(DirEntry)`.
|
|
270
|
+
/// Skips the `.` and `..` entries.
|
|
264
271
|
read_dir :: (fn(path: Path, using(io : IO)) -> Impl(Future(ArrayList(DirEntry), IO, Exception)))(
|
|
265
272
|
io.async((using(io, exn)) => {
|
|
266
273
|
cstr_bytes := path.to_string().to_cstr();
|