updated via script

main
m455 2018-03-16 09:53:12 -04:00
parent 7cdd820138
commit 7fc999e7e3
3 changed files with 23 additions and 19 deletions

0
LICENSE 100644 → 100755
View File

0
README.md 100644 → 100755
View File

View File

@ -4,17 +4,20 @@
(define (display-hash hash-list key)
(displayln (hash-ref hash-list key)))
(define message (hash
'incorrect-usage-msg "For usage type `rodo -h` or `rodo --help`"
'file-not-found "rodo has not been setup in your home directory\nWould you like to set it up now? [y/n]"
'file-exists ".rodo file exists"
'item-added "Item added"
'item-removed "Item removed"
'initializing "Initializing rodo in your home directory"))
(define messages (hash
'incorrect-usage "For usage type `rodo -h` or `rodo --help`"
'file-not-found "rodo has not been setup in your home directory\nWould you like to set it up now? [y/n]"
'file-exists ".rodo file exists"
'creating-file "> Creating .rodo file in your home directory..."
'item-added "Item added"
'item-removed "Item removed"
'initializing "Initializing rodo in your home directory"
'terminating "Terminating rodo..."
'choose-y/n "Error: Please choose y or n"))
(define y-n (hash
'yes '("yes" "Yes" "y" "Y")
'no '("no" "No" "n" "N")))
(define y/n (hash
'yes '("yes" "Yes" "y" "Y")
'no '("no" "No" "n" "N")))
(define (open/create-file path)
(let ([path (expand-user-path path)])
@ -24,20 +27,21 @@
; just figuring out stuff here
(define (prompt-user prompt-message)
(display-hash message prompt-message)
(display-hash messages prompt-message)
(let ([user-input (read-line)])
(cond
[(member user-input (hash-ref y-n 'yes))
(displayln "You chose yes")
[(member user-input (hash-ref y/n 'yes))
(display-hash messages 'creating-file)
(open/create-file "~/.rodo")]
[(member user-input (hash-ref y-n 'no))
(displayln "You chose no")]
[(member user-input (hash-ref y/n 'no))
(display-hash messages 'terminating)]
[else
(displayln "you chose something else")])))
(display-hash messages 'choose-y/n)
(prompt-user 'file-not-found)])))
(define (todo-list-exist?)
(if (file-exists? (expand-user-path "~/.rodo"))
(display-hash message 'file-exists)
(prompt-user 'file-not-found)))
(display-hash messages 'file-exists)
(prompt-user 'file-not-found)))
(todo-list-exist?)
(todo-list-exist?)