removed unused function

main
m455 2019-01-31 22:56:48 -05:00
parent 081392eb63
commit 45f8c22e1a
2 changed files with 49 additions and 50 deletions

View File

@ -6,38 +6,38 @@
(define messages
(hash
'show-help
(string-append
config:initialize-command ":\n"
"initialize a file in "
config:program-path
config:program-directory
config:program-file
"\n"
"Example: "
"rodo init\n\n"
'show-help (string-append
config:initialize-command
" - "
"initialize a file in "
config:program-path
config:program-directory
config:program-file
"\n"
"Example: "
"rodo init\n\n"
config:list-command ":\n"
"lists items on the list"
"\n"
"Example: "
"rodo ls\n\n"
config:list-command ":\n"
"lists items on the list"
"\n"
"Example: "
"rodo ls\n\n"
config:add-command ":\n"
"adds an item to the list"
"\n"
"Example: "
"rodo add bread\n\n"
"Note: For multi-word items you will need to\n"
"surround your item in double quotes as so:\n"
"rodo add \"go to the bank\"\n\n"
config:add-command ":\n"
"adds an item to the list"
"\n"
"Example: "
"rodo add bread\n\n"
"Note: For multi-word items you will need to\n"
"surround your item in double quotes as so:\n"
"rodo add \"go to the bank\"\n\n"
config:remove-command ":\n"
"removes an item from the list\n"
"Example: "
"rodo rm 1\n\n"
"Note: You may have to run `rodo ls` to see which\n"
"number corresponds to which item to remove it.\n")
config:remove-command ":\n"
"removes an item from the list\n"
"Example: "
"rodo rm 1\n\n"
"Note: You may have to run `rodo ls` to see which\n"
"number corresponds to which item to remove it.\n")
'empty-todo-list
"> There is nothing in your list \n"

View File

@ -33,13 +33,10 @@
(define (display-hash-ref hash-list key)
(display (hash-ref hash-list key)))
(define (d-vector-ref args key)
(display (vector-ref args key)))
(define (file->string-list config:path-to-file)
(let ([todo-list (file:file->lines config:path-to-file
#:mode 'text
#:line-mode 'any)])
(let ([todo-list (file:file->lines config:path-to-file
#:mode 'text
#:line-mode 'any)])
todo-list))
(define (list-empty? lst)
@ -53,9 +50,11 @@
(string-append "\"" args "\"")))
(define (prefix-with-number lst)
(map string-append
(map number->string (list:rest (list:range (length lst))))
(list:rest lst)))
(map string-append
(map number->string
(list:rest
(list:range (length lst))))
(list:rest lst)))
(define (prefix-with-period lst)
(string-append ". " lst))
@ -63,8 +62,8 @@
(define (prettify-list)
(display
(string:string-join (prefix-with-number (map prefix-with-period (file->string-list config:path)))
"\n"
#:after-last "\n")))
"\n"
#:after-last "\n")))
(define (append-to-end args lst)
(reverse (cons args (reverse (file->string-list lst)))))
@ -93,7 +92,7 @@
(define (add-item-to-file args)
(let ([new-list (append-to-end args config:path)])
(file:display-to-file
(file:display-to-file
(string:string-join new-list "\n" #:after-last "\n")
config:path
#:mode 'text
@ -111,10 +110,10 @@
(define (remove-item-from-file args)
(let ([removed-item (get-removed-item (file->string-list config:path) args)]
[new-list (remove
(list-ref (file->string-list config:path) (string->number args))
[new-list (remove
(list-ref (file->string-list config:path) (string->number args))
(file->string-list config:path))])
(file:display-to-file
(file:display-to-file
(string:string-join new-list "\n" #:after-last "\n")
config:path
#:mode 'text
@ -124,11 +123,11 @@
(define (remove-item args)
(cond [(list-empty? config:path)
(display-hash-ref messages:messages 'empty-todo-list)]
[(and
[(and
(check-for-folder)
(check-for-file))
(remove-item-from-file (vector-ref args 1))]
[(and (not (check-for-folder)) (not (check-for-file)))
(begin
(display-hash-ref messages:messages 'file-not-found)
(display-hash-ref messages:messages 'try-init))]))
(remove-item-from-file (vector-ref args 1))]
[(and (not (check-for-folder)) (not (check-for-file)))
(begin
(display-hash-ref messages:messages 'file-not-found)
(display-hash-ref messages:messages 'try-init))]))