From 6f8e692be1c196113b91ad1986a00c9d6f6f0e48 Mon Sep 17 00:00:00 2001 From: hachem Date: Wed, 21 Oct 2026 06:45:53 +0200 Subject: feat: user stuff like perms etc.. --- gils/chmod.rv | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gils/chmod.rv (limited to 'gils/chmod.rv') diff --git a/gils/chmod.rv b/gils/chmod.rv new file mode 100644 index 0000000..f798659 --- /dev/null +++ b/gils/chmod.rv @@ -0,0 +1,23 @@ +# chmod num do + let value = 0 + for index in 0..text:len() do + const code = text[index]:ascii() + if (code >= 48 and code <= 55) + value = value * 8 + (code - 48) + end + return value +end + +const context = env.ctx + +if context.argv:len() < 3 do + fail("usage: chmod \n") +end else do + const mode = parse_octal(context.argv[1]) + const path = expand_path(context.argv[2]) + if (fs:chmod(path, mode) == :false) + fail("chmod: #{path}: no such file\n") +end -- cgit v1.3