From a8c55c6f71420889bb4b837ec95ea094b02549e1 Mon Sep 17 00:00:00 2001 From: m455 Date: Mon, 12 Mar 2018 22:19:16 -0400 Subject: [PATCH] updated via script --- rodo.rkt | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/rodo.rkt b/rodo.rkt index 2afc602..223592b 100755 --- a/rodo.rkt +++ b/rodo.rkt @@ -1,20 +1,30 @@ #! /usr/bin/env racket #lang racket/base +(define (display-hash hash-list key) + (displayln (hash-ref hash-list key))) + (define message (hash - 'help-message "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?" + 'help-messages "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")) +; 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?) (if (file-exists? (expand-user-path "~/.rodo")) - ; the displayln here removes the quotes from appearing - ; in the stdout. from ".rodo file exists" -> .rodo file exists - ; not sure if this is the cleanest way to do so - (displayln (hash-ref message 'file-exists)) - (displayln (hash-ref message 'file-not-found)))) + (display-hash message 'file-exists) + (prompt-user 'file-not-found))) (todo-list-exist?)