implement rm command

This commit is contained in:
2025-09-09 17:36:39 -07:00
parent eb440261d7
commit 021eac1949

View File

@@ -112,10 +112,21 @@
(flush-output)]
[(list _ "ed" name)
(let ([path (if (file-exists? name)
(ed (our-make-temporary-file name))
(ed))])
(copy-file path name #:exists-ok? #t))]
(let ([path (build-path (current-directory)
(string->path-element name))])
(let ([path (if (file-exists? path)
(ed (our-make-temporary-file path))
(ed))])
(copy-file path name #:exists-ok? #t)))]
[(list _ "rm" name)
(let ([path (build-path (current-directory)
(string->path-element name))])
(if (file-exists? path)
(delete-file path)
(displayln "file does not exist"))
(flush-output))]
[(or (list _ "bye" _)
(list _ "b" _)