diff options
author | Tom Willemsen | 2012-09-16 14:22:44 +0200 |
---|---|---|
committer | Tom Willemsen | 2012-09-16 14:22:44 +0200 |
commit | 3d7138e45af5a288995442dff249e8eaa00803d5 (patch) | |
tree | 9122b1b9b0c9b5aa634ed293a93a58e5288c2531 | |
parent | cae98ebdfbf9a1a852a810dc7d43a9717f7c7a9a (diff) | |
download | undone-3d7138e45af5a288995442dff249e8eaa00803d5.tar.gz undone-3d7138e45af5a288995442dff249e8eaa00803d5.zip |
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.
-rw-r--r-- | undone/main.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/undone/main.scm b/undone/main.scm index 2f400e9..f627c31 100644 --- a/undone/main.scm +++ b/undone/main.scm @@ -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) |