can now accept LICENSE
README.md rodo.rkt as an argument. todo: check for file when calling LICENSE README.md rodo.rktmain
parent
bcc3038505
commit
a2a16bddc3
24
rodo.rkt
24
rodo.rkt
|
@ -10,6 +10,10 @@
|
||||||
(define program-path "~/")
|
(define program-path "~/")
|
||||||
(define program-file "todo-list")
|
(define program-file "todo-list")
|
||||||
(define bullet "*")
|
(define bullet "*")
|
||||||
|
(define remove-command "rm")
|
||||||
|
(define add-command "add")
|
||||||
|
(define list-command "ls")
|
||||||
|
(define initialize-command "init")
|
||||||
|
|
||||||
(define (d-hash-ref hash-list key)
|
(define (d-hash-ref hash-list key)
|
||||||
(display (hash-ref hash-list key)))
|
(display (hash-ref hash-list key)))
|
||||||
|
@ -118,14 +122,14 @@
|
||||||
'no
|
'no
|
||||||
'("no" "No" "n" "N")))
|
'("no" "No" "n" "N")))
|
||||||
|
|
||||||
(define (create-bullets)
|
(define (add-bullets)
|
||||||
(lambda (lst)
|
(lambda (lst)
|
||||||
(string-append
|
(string-append
|
||||||
bullet
|
bullet
|
||||||
" "
|
" "
|
||||||
lst)))
|
lst)))
|
||||||
|
|
||||||
(define (show-list)
|
(define (show-list);; todo check for file like other functions
|
||||||
(let
|
(let
|
||||||
([path
|
([path
|
||||||
(expand-user-path
|
(expand-user-path
|
||||||
|
@ -140,8 +144,9 @@
|
||||||
#:line-mode 'linefeed)])
|
#:line-mode 'linefeed)])
|
||||||
(display
|
(display
|
||||||
(string-join
|
(string-join
|
||||||
(map (create-bullets)
|
(map (add-bullets)
|
||||||
todo-items) "\n")))))
|
todo-items) "\n"
|
||||||
|
#:after-last "\n")))))
|
||||||
|
|
||||||
(define (add-item-to-file item)
|
(define (add-item-to-file item)
|
||||||
(let ([item (string-append item "\n")])
|
(let ([item (string-append item "\n")])
|
||||||
|
@ -250,19 +255,24 @@
|
||||||
(let
|
(let
|
||||||
([args-length (vector-length args)])
|
([args-length (vector-length args)])
|
||||||
(cond
|
(cond
|
||||||
|
[(and
|
||||||
|
(equal? args-length 1)
|
||||||
|
(equal? (vector-member list-command args) 0))
|
||||||
|
(show-list)]
|
||||||
|
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 2)
|
(equal? args-length 2)
|
||||||
(equal? (vector-member "add" args) 0))
|
(equal? (vector-member add-command args) 0))
|
||||||
(add-item args)]
|
(add-item args)]
|
||||||
|
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 2)
|
(equal? args-length 2)
|
||||||
(equal? (vector-member "remove" args) 0))
|
(equal? (vector-member remove-command args) 0))
|
||||||
(remove-item args)]
|
(remove-item args)]
|
||||||
|
|
||||||
[(and
|
[(and
|
||||||
(equal? args-length 1)
|
(equal? args-length 1)
|
||||||
(equal? (vector-member "init" args) 0))
|
(equal? (vector-member initialize-command args) 0))
|
||||||
(initialize)]
|
(initialize)]
|
||||||
|
|
||||||
[else
|
[else
|
||||||
|
|
Loading…
Reference in New Issue