plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
508207a
— Peter John
2026-08-09T21:58:44+05:30
style(libs/std): rename camelCase params to snake_case (os.plum, http.plum)
- libs/std/http.plum +7 -7
- libs/std/os.plum +2 -2
libs/std/http.plum
CHANGED
|
@@ -9,20 +9,20 @@ type Response =
|
|
|
9
9
|
body: Buffer
|
|
10
10
|
status: Int
|
|
11
11
|
|
|
12
|
-
# builds a Response by reading the file at `
|
|
12
|
+
# builds a Response by reading the file at `file_path` and inferring its content type.
|
|
13
13
|
# NOTE: the original used a `Response::create()` fluent builder chain
|
|
14
14
|
# (`.header(...).contentType(...).body(...).status(...)`), but this language has
|
|
15
15
|
# no "::" static-call syntax and no mutating "with"-style builder methods, so
|
|
16
16
|
# this constructs the Response directly instead.
|
|
17
|
-
fun createFileResponse(
|
|
17
|
+
fun createFileResponse(file_path: Str) -> Response =
|
|
18
|
-
content = content_type.fromExt(
|
|
18
|
+
content = content_type.fromExt(file_path.ext())
|
|
19
|
-
data = os.readFile(
|
|
19
|
+
data = os.readFile(file_path)
|
|
20
20
|
Response(headers: Map(), body: data, status: 200)
|
|
21
21
|
|
|
22
22
|
fun index() -> Response =
|
|
23
23
|
createFileResponse("index.html")
|
|
24
24
|
|
|
25
|
-
fun serveFile(
|
|
25
|
+
fun serveFile(file_path: Str) -> Response =
|
|
26
|
-
content = content_type.fromExt(
|
|
26
|
+
content = content_type.fromExt(file_path.ext())
|
|
27
|
-
data = os.readFile(
|
|
27
|
+
data = os.readFile(file_path)
|
|
28
28
|
Response(headers: Map(), body: data, status: 200)
|
libs/std/os.plum
CHANGED
|
@@ -52,7 +52,7 @@ fun lchown(path: Str, uid: Int, gid: Int) =
|
|
|
52
52
|
fun lutimes(path: Str, atime: Int, mtime: Int) =
|
|
53
53
|
todo
|
|
54
54
|
|
|
55
|
-
fun link(
|
|
55
|
+
fun link(existing_path: Str, new_path: Str) =
|
|
56
56
|
todo
|
|
57
57
|
|
|
58
58
|
fun lstat(path: Str) =
|
|
@@ -79,7 +79,7 @@ fun readlink(path: Str) =
|
|
|
79
79
|
fun realpath(path: Str) =
|
|
80
80
|
todo
|
|
81
81
|
|
|
82
|
-
fun rename(
|
|
82
|
+
fun rename(old_path: Str, new_path: Str) =
|
|
83
83
|
todo
|
|
84
84
|
|
|
85
85
|
fun rmdir(path: Str) =
|