From 5d4a723a5f157c0ed38a348099a600d1d21c3c2b Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 6 Oct 2026 12:49:46 +0200 Subject: feat: gils core utils and other shit --- gils/mv.rv | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gils/mv.rv (limited to 'gils/mv.rv') diff --git a/gils/mv.rv b/gils/mv.rv new file mode 100644 index 0000000..95d9a40 --- /dev/null +++ b/gils/mv.rv @@ -0,0 +1,14 @@ +# move or rename a file + +const context = env.ctx +if context.argv:len() < 3 do puts("usage: mv \n") end +else do + const source = abspath(context.argv[1]) + const destination = abspath(context.argv[2]) + const size = fs:size(source) + if size < 0 do puts("mv: #{source}: no such file\n") end + else do + const contents = if size > 0 fs:read_bytes(source, 0, size) else "" + if fs:store(destination, contents) == 1 do fs:unlink(source) puts("#{source} -> #{destination}\n") end + end +end -- cgit v1.3