diff --git a/src/init.rkt b/src/init.rkt index c216e84..960c176 100644 --- a/src/init.rkt +++ b/src/init.rkt @@ -8,8 +8,8 @@ (define (create-initialization-contents) (utils:display-messages '(creating)) - (utils:create-directory-700 config:program-directory) - (utils:create-file-600 config:list-file) + (utils:directory-create-700 config:program-directory) + (utils:file-create-600 config:list-file) (if (and (directory-exists? config:program-directory) (file-exists? config:list-file)) (utils:display-messages '(successfully-created)) diff --git a/src/messages.rkt b/src/messages.rkt index 5516685..56b6b4f 100644 --- a/src/messages.rkt +++ b/src/messages.rkt @@ -58,21 +58,21 @@ 'show-usage (format "> For usage type ~a -h\n" config:program-name) - 'creating (format "> Creating a list in ~a...\n" config:list-file) + 'creating (format "> Creating a list at ~a...\n" config:list-file) - 'creation-error (format "> Error: Could not create a list file in ~a\n" config:list-file) + 'creation-error (format "> Error: Could not create a list file at ~a\n" config:list-file) - 'file-already-exists (format "> Error: A list file already exists in ~a\n" config:list-file) + 'file-already-exists (format "> Error: A list file already exists at ~a\n" config:list-file) - 'successfully-created (format "> Your list file was successfully created in ~a\n" config:list-file) + 'successfully-created (format "> Your list file was successfully created at ~a\n" config:list-file) 'file-not-found (format "> Error: Could not find ~a\n" config:list-file) 'item-not-found "> Error: Could not find that item\n" - 'init-y/n (format "> A list file will be created in ~a\n> Are you sure you want to continue? [y/n]\n" config:list-file) + 'init-y/n (format "> A list file will be created at ~a\n> Are you sure you want to continue? [y/n]\n" config:list-file) - 'try-init (format "> Try typing ~a ~a to set it up\n" config:program-name (car config:initialize-commands)) + 'try-init (format "> Try typing the following to setup ~a:\n~a ~a\n" config:program-name config:program-name (car config:initialize-commands)) 'terminating (format "> Exited ~a\n" config:program-name) diff --git a/src/rodo-backup/list.txt b/src/rodo-backup/list.txt new file mode 100644 index 0000000..873660d --- /dev/null +++ b/src/rodo-backup/list.txt @@ -0,0 +1,7 @@ +work on wg +make pet game thing in chicken scheme +learn assembly from https://skilldrick.github.io/easy6502/#snake +work on generic tilde docs +work on tildemush docs +rewrite and decentralize nicethings in another lang +rewrite rodo in chicken-scheme diff --git a/src/utils.rkt b/src/utils.rkt index e098d26..0db7cc6 100644 --- a/src/utils.rkt +++ b/src/utils.rkt @@ -8,12 +8,12 @@ (provide (all-defined-out)) -(define (create-file-600 a-file) +(define (file-create-600 a-file) (let ([opened-file (open-output-file a-file #:mode 'text #:exists 'truncate)]) (close-output-port opened-file)) (file-or-directory-permissions a-file #o600)) -(define (create-directory-700 a-directory) +(define (directory-create-700 a-directory) (make-directory a-directory) (file-or-directory-permissions a-directory #o700)) @@ -67,7 +67,7 @@ (define (append-element-to-end-of-list lst item-to-add) (reverse (cons item-to-add (reverse (file:file->lines lst))))) -(define (add-item-to-list args) +(define (item-add args) (let* ([item-to-add (string:string-join (cdr args) " ")] [new-list (append-element-to-end-of-list config:list-file item-to-add)]) (file:display-lines-to-file new-list @@ -78,12 +78,12 @@ (define (check-add-conditions args) (if (and (file-exists? config:list-file)) - (add-item-to-list args) - ;; Otherwise - (display-messages '(file-not-found - try-init)))) + (item-add args) + ;; Otherwise + (display-messages '(file-not-found + try-init)))) -(define (remove-item-from-list args) +(define (item-remove args) (let* ([item-to-remove (list-ref (file:file->lines config:list-file) args)] [new-list (remove item-to-remove (file:file->lines config:list-file))]) (file:display-lines-to-file new-list config:list-file #:mode 'text #:exists 'truncate) @@ -105,12 +105,11 @@ ;; Length subtract one because the numbering starts at zero [list-length (sub1 (length (file:file->lines config:list-file)))]) (if (not (> args list-length)) - (remove-item-from-list args) - ;; Otherwise - (display-messages '(item-not-found))))] + (item-remove args) + ;; Otherwise + (display-messages '(item-not-found))))] ;; If directory and file don't exist [(and (not (directory-exists? config:program-directory)) (not (file-exists? config:list-file))) - (display-messages '(file-not-found - try-init))])) + (display-messages '(file-not-found try-init))]))