removed unused function
parent
081392eb63
commit
45f8c22e1a
58
messages.rkt
58
messages.rkt
|
@ -6,38 +6,38 @@
|
||||||
|
|
||||||
(define messages
|
(define messages
|
||||||
(hash
|
(hash
|
||||||
'show-help
|
'show-help (string-append
|
||||||
(string-append
|
config:initialize-command
|
||||||
config:initialize-command ":\n"
|
" - "
|
||||||
"initialize a file in "
|
"initialize a file in "
|
||||||
config:program-path
|
config:program-path
|
||||||
config:program-directory
|
config:program-directory
|
||||||
config:program-file
|
config:program-file
|
||||||
"\n"
|
"\n"
|
||||||
"Example: "
|
"Example: "
|
||||||
"rodo init\n\n"
|
"rodo init\n\n"
|
||||||
|
|
||||||
config:list-command ":\n"
|
config:list-command ":\n"
|
||||||
"lists items on the list"
|
"lists items on the list"
|
||||||
"\n"
|
"\n"
|
||||||
"Example: "
|
"Example: "
|
||||||
"rodo ls\n\n"
|
"rodo ls\n\n"
|
||||||
|
|
||||||
config:add-command ":\n"
|
config:add-command ":\n"
|
||||||
"adds an item to the list"
|
"adds an item to the list"
|
||||||
"\n"
|
"\n"
|
||||||
"Example: "
|
"Example: "
|
||||||
"rodo add bread\n\n"
|
"rodo add bread\n\n"
|
||||||
"Note: For multi-word items you will need to\n"
|
"Note: For multi-word items you will need to\n"
|
||||||
"surround your item in double quotes as so:\n"
|
"surround your item in double quotes as so:\n"
|
||||||
"rodo add \"go to the bank\"\n\n"
|
"rodo add \"go to the bank\"\n\n"
|
||||||
|
|
||||||
config:remove-command ":\n"
|
config:remove-command ":\n"
|
||||||
"removes an item from the list\n"
|
"removes an item from the list\n"
|
||||||
"Example: "
|
"Example: "
|
||||||
"rodo rm 1\n\n"
|
"rodo rm 1\n\n"
|
||||||
"Note: You may have to run `rodo ls` to see which\n"
|
"Note: You may have to run `rodo ls` to see which\n"
|
||||||
"number corresponds to which item to remove it.\n")
|
"number corresponds to which item to remove it.\n")
|
||||||
|
|
||||||
'empty-todo-list
|
'empty-todo-list
|
||||||
"> There is nothing in your list \n"
|
"> There is nothing in your list \n"
|
||||||
|
|
41
util.rkt
41
util.rkt
|
@ -33,13 +33,10 @@
|
||||||
(define (display-hash-ref hash-list key)
|
(define (display-hash-ref hash-list key)
|
||||||
(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)
|
(define (file->string-list config:path-to-file)
|
||||||
(let ([todo-list (file:file->lines config:path-to-file
|
(let ([todo-list (file:file->lines config:path-to-file
|
||||||
#:mode 'text
|
#:mode 'text
|
||||||
#:line-mode 'any)])
|
#:line-mode 'any)])
|
||||||
todo-list))
|
todo-list))
|
||||||
|
|
||||||
(define (list-empty? lst)
|
(define (list-empty? lst)
|
||||||
|
@ -53,9 +50,11 @@
|
||||||
(string-append "\"" args "\"")))
|
(string-append "\"" args "\"")))
|
||||||
|
|
||||||
(define (prefix-with-number lst)
|
(define (prefix-with-number lst)
|
||||||
(map string-append
|
(map string-append
|
||||||
(map number->string (list:rest (list:range (length lst))))
|
(map number->string
|
||||||
(list:rest lst)))
|
(list:rest
|
||||||
|
(list:range (length lst))))
|
||||||
|
(list:rest lst)))
|
||||||
|
|
||||||
(define (prefix-with-period lst)
|
(define (prefix-with-period lst)
|
||||||
(string-append ". " lst))
|
(string-append ". " lst))
|
||||||
|
@ -63,8 +62,8 @@
|
||||||
(define (prettify-list)
|
(define (prettify-list)
|
||||||
(display
|
(display
|
||||||
(string:string-join (prefix-with-number (map prefix-with-period (file->string-list config:path)))
|
(string:string-join (prefix-with-number (map prefix-with-period (file->string-list config:path)))
|
||||||
"\n"
|
"\n"
|
||||||
#:after-last "\n")))
|
#:after-last "\n")))
|
||||||
|
|
||||||
(define (append-to-end args lst)
|
(define (append-to-end args lst)
|
||||||
(reverse (cons args (reverse (file->string-list lst)))))
|
(reverse (cons args (reverse (file->string-list lst)))))
|
||||||
|
@ -93,7 +92,7 @@
|
||||||
|
|
||||||
(define (add-item-to-file args)
|
(define (add-item-to-file args)
|
||||||
(let ([new-list (append-to-end args config:path)])
|
(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")
|
(string:string-join new-list "\n" #:after-last "\n")
|
||||||
config:path
|
config:path
|
||||||
#:mode 'text
|
#:mode 'text
|
||||||
|
@ -111,10 +110,10 @@
|
||||||
|
|
||||||
(define (remove-item-from-file args)
|
(define (remove-item-from-file args)
|
||||||
(let ([removed-item (get-removed-item (file->string-list config:path) args)]
|
(let ([removed-item (get-removed-item (file->string-list config:path) args)]
|
||||||
[new-list (remove
|
[new-list (remove
|
||||||
(list-ref (file->string-list config:path) (string->number args))
|
(list-ref (file->string-list config:path) (string->number args))
|
||||||
(file->string-list config:path))])
|
(file->string-list config:path))])
|
||||||
(file:display-to-file
|
(file:display-to-file
|
||||||
(string:string-join new-list "\n" #:after-last "\n")
|
(string:string-join new-list "\n" #:after-last "\n")
|
||||||
config:path
|
config:path
|
||||||
#:mode 'text
|
#:mode 'text
|
||||||
|
@ -124,11 +123,11 @@
|
||||||
(define (remove-item args)
|
(define (remove-item args)
|
||||||
(cond [(list-empty? config:path)
|
(cond [(list-empty? config:path)
|
||||||
(display-hash-ref messages:messages 'empty-todo-list)]
|
(display-hash-ref messages:messages 'empty-todo-list)]
|
||||||
[(and
|
[(and
|
||||||
(check-for-folder)
|
(check-for-folder)
|
||||||
(check-for-file))
|
(check-for-file))
|
||||||
(remove-item-from-file (vector-ref args 1))]
|
(remove-item-from-file (vector-ref args 1))]
|
||||||
[(and (not (check-for-folder)) (not (check-for-file)))
|
[(and (not (check-for-folder)) (not (check-for-file)))
|
||||||
(begin
|
(begin
|
||||||
(display-hash-ref messages:messages 'file-not-found)
|
(display-hash-ref messages:messages 'file-not-found)
|
||||||
(display-hash-ref messages:messages 'try-init))]))
|
(display-hash-ref messages:messages 'try-init))]))
|
||||||
|
|
Loading…
Reference in New Issue