anoia: add basename, dirname

This commit is contained in:
Daniel Barlow 2024-04-10 19:34:09 +01:00
parent f4bf3029fa
commit b231664a06

View file

@ -18,6 +18,12 @@
f (do (f:close) true)
_ false))
(fn basename [path]
(string.match path ".*/([^/]-)$"))
(fn dirname [path]
(string.match path "(.*)/[^/]-$"))
(fn system [s]
(match (os.execute s)
res (do (print (.. "Executed \"" s "\", exit code " (tostring res))) res)
@ -69,6 +75,8 @@
{
: assoc
: base64url
: basename
: dirname
: dup
: file-exists?
: hash