Add delete command

The delete command removes an item from the todo-list, it does this by
filtering out the item wich has the given `id' value and saving the
result.
This commit is contained in:
Tom Willemsen 2012-09-16 14:22:44 +02:00
parent cae98ebdfb
commit 3d7138e45a

View file

@ -157,6 +157,14 @@
(cons var val)))
args))))))
(define (delete args)
"Delete the specified element."
(set! todo-list
(filter (lambda (elm)
(not (eq? (get-field-value id elm)
(string->number (car args)))))
todo-list)))
(define-view default
"Default todo-list view, show only the title."
"~2d ~a~%" id content)
@ -188,6 +196,9 @@
((add)
(add (list-tail args 2))
(save))
((delete)
(delete (list-tail args 2))
(save))
((view)
(view (list-tail args 2)))
((views)