removed the negative number bug, and stopped allowing symbols
parent
6966408e53
commit
8eb4cd799b
|
@ -6,7 +6,6 @@ By Jesse Laprade
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
- [ ] Don't allow users to remove negative numbers
|
|
||||||
- [ ] Only allow quoted items to be added
|
- [ ] Only allow quoted items to be added
|
||||||
- [ ] Add color option to config file
|
- [ ] Add color option to config file
|
||||||
- [ ] Encrypt todo list file
|
- [ ] Encrypt todo list file
|
||||||
|
|
15
args.rkt
15
args.rkt
|
@ -15,32 +15,35 @@
|
||||||
[(equal? args-length 0)
|
[(equal? args-length 0)
|
||||||
(util:display-hash-ref messages:messages 'show-usage)]
|
(util:display-hash-ref messages:messages 'show-usage)]
|
||||||
|
|
||||||
|
;; ls
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 1)
|
(equal? args-length 1)
|
||||||
(equal? (vector:vector-member config:list-command args) 0))
|
(equal? (vector:vector-member config:list-command args) 0))
|
||||||
(util:show-list)]
|
(util:show-list)]
|
||||||
|
|
||||||
|
;; add
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 2)
|
(equal? args-length 2)
|
||||||
(equal? (vector-ref args 0) config:add-command))
|
(equal? (vector-ref args 0) config:add-command))
|
||||||
(util:add-item args)]
|
(util:add-item args)]
|
||||||
|
|
||||||
|
;; rm
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 2)
|
(equal? args-length 2)
|
||||||
(equal? (vector:vector-member config:remove-command args) 0)
|
(equal? (vector:vector-member config:remove-command args) 0)
|
||||||
;; Don't allow user to remove zeroth item
|
(real? (string->number (vector-ref args 1)))
|
||||||
(not (equal? (vector:vector-member "0" args) 1))
|
|
||||||
;; Number is positive
|
|
||||||
(positive? (string->number (vector-ref args 1)))
|
(positive? (string->number (vector-ref args 1)))
|
||||||
;; Don't allow removal of items beyond last item
|
(not (> (string->number (vector-ref args 1)) (length (util:file->string-list config:path))))
|
||||||
(not (> (string->number (vector-ref args 1)) (length (util:file->string-list config:path)))))
|
(not (< (string->number (vector-ref args 1)) (car (list:range (length (util:file->string-list config:path))))))
|
||||||
(util:remove-item args)]
|
(util:remove-item args))]
|
||||||
|
|
||||||
|
;; init
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 1)
|
(equal? args-length 1)
|
||||||
(equal? (vector:vector-member config:initialize-command args) 0))
|
(equal? (vector:vector-member config:initialize-command args) 0))
|
||||||
(init:initialize)]
|
(init:initialize)]
|
||||||
|
|
||||||
|
;; help
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 1)
|
(equal? args-length 1)
|
||||||
(member (vector-ref args 0) config:help-command))
|
(member (vector-ref args 0) config:help-command))
|
||||||
|
|
Loading…
Reference in New Issue