can now add items from command-line arguments, but need to add EOLS to each item
This commit is contained in:
		
							parent
							
								
									db35f12db3
								
							
						
					
					
						commit
						4bd3024453
					
				
							
								
								
									
										23
									
								
								rodo.rkt
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								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)) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user