can now add items from command-line arguments, but need to add EOLS to each item

main
m455 2018-04-07 10:46:43 -04:00
parent db35f12db3
commit 4bd3024453
1 changed files with 14 additions and 9 deletions

View File

@ -108,6 +108,19 @@
'no 'no
'("no" "No" "n" "N"))) '("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) (define (create-file)
(let (let
([path ([path
@ -121,15 +134,6 @@
(open-output-file path (open-output-file path
#:mode 'text #:mode 'text
#:exists 'can-update)]) #: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)))) (close-output-port opened-file))))
(define (create-folder) (define (create-folder)
@ -184,6 +188,7 @@
(check-for-folder) (check-for-folder)
(check-for-file)) (check-for-file))
(begin (begin
(add-item-to-file (vector-ref args 1))
(d-hash-ref messages 'item-added-prefix) (d-hash-ref messages 'item-added-prefix)
(d-vector-ref args 1) (d-vector-ref args 1)
(d-hash-ref messages 'item-added-suffix)) (d-hash-ref messages 'item-added-suffix))