anoia: add basename, dirname

main
Daniel Barlow 2024-04-10 19:34:09 +01:00
parent f4bf3029fa
commit b231664a06
1 changed files with 8 additions and 0 deletions

View File

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