From 4bd302445309c8cb21dffc31d96896fb1d4d668d Mon Sep 17 00:00:00 2001 From: m455 Date: Sat, 7 Apr 2018 10:46:43 -0400 Subject: [PATCH] can now add items from command-line arguments, but need to add EOLS to each item --- rodo.rkt | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/rodo.rkt b/rodo.rkt index 1d3add2..230f586 100755 --- a/rodo.rkt +++ b/rodo.rkt @@ -108,6 +108,19 @@ 'no '("no" "No" "n" "N"))) +(define (add-item-to-file item) ;; need to figure out how to add an EOL to each item + (let + ([path + (expand-user-path + (string-append + program-path + program-directory + program-file))]) + (write-to-file item + path + #:mode 'text + #:exists 'append))) + (define (create-file) (let ([path @@ -121,15 +134,6 @@ (open-output-file path #:mode 'text #:exists 'can-update)]) - ;;TODO: - ;;I think i can write to file with - ;;a function right here... - ;;NOTE: this works when doing `./rodo.rkt init`, - ;;just gotta separate it into another function - (write-to-file "test" - path - #:mode 'text - #:exists 'append) (close-output-port opened-file)))) (define (create-folder) @@ -184,6 +188,7 @@ (check-for-folder) (check-for-file)) (begin + (add-item-to-file (vector-ref args 1)) (d-hash-ref messages 'item-added-prefix) (d-vector-ref args 1) (d-hash-ref messages 'item-added-suffix))