updated via script

main
m455 2018-03-12 22:19:16 -04:00
parent e26e78c58c
commit a8c55c6f71
1 changed files with 17 additions and 7 deletions

View File

@ -1,20 +1,30 @@
#! /usr/bin/env racket #! /usr/bin/env racket
#lang racket/base #lang racket/base
(define (display-hash hash-list key)
(displayln (hash-ref hash-list key)))
(define message (hash (define message (hash
'help-message "For usage type `rodo -h` or `rodo --help`" 'help-messages "For usage type `rodo -h` or `rodo --help`"
'file-not-found ".rodo file was not found in your home directory. Would you like to create it?" '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" 'file-exists ".rodo file exists"
'item-added "Item added" 'item-added "Item added"
'item-removed "item removed" 'item-removed "item removed"
'initializing "Initializing rodo in your home directory")) 'initializing "Initializing rodo in your home directory"))
; just figuring out stuff here
(define (prompt-user prompt-message)
(display-hash message prompt-message)
(let ([user-input (read-line)])
(cond
[(member user-input '("yes" "Yes" "y" "Y"))
(displayln "You chose yes")]
[else
(displayln "you chose something else")])))
(define (todo-list-exist?) (define (todo-list-exist?)
(if (file-exists? (expand-user-path "~/.rodo")) (if (file-exists? (expand-user-path "~/.rodo"))
; the displayln here removes the quotes from appearing (display-hash message 'file-exists)
; in the stdout. from ".rodo file exists" -> .rodo file exists (prompt-user 'file-not-found)))
; not sure if this is the cleanest way to do so
(displayln (hash-ref message 'file-exists))
(displayln (hash-ref message 'file-not-found))))
(todo-list-exist?) (todo-list-exist?)