implement rm command
This commit is contained in:
19
palps.rkt
19
palps.rkt
@@ -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" _)
|
||||
|
||||
Reference in New Issue
Block a user