cleaned up help messages code-wise

main
Jesse Laprade 2020-05-27 13:27:48 -04:00
parent 28c5477eb7
commit 0ff1708282
1 changed files with 38 additions and 29 deletions

View File

@ -12,70 +12,78 @@
(define newline "\n") (define newline "\n")
(define newline-double "\n\n") (define newline-double "\n\n")
(define program-name config:program-name)
(define list-file config:list-file)
(define help-command (car config:help-commands)
(define initialize-command (car config:initialize-commands))
(define list-command (car config:list-commands))
(define add-command (car config:add-commands))
(define remove-command (car config:remove-commands))
(define messages (define messages
(hash (hash
'show-help 'show-help
(string-append (string-append
"NAME" newline "NAME" newline
tab-half (format "~a" config:program-name) newline-double tab-half (format "~a" program-name) newline-double
"DESCRIPTION" newline "DESCRIPTION" newline
tab-half (format "~a is a todo-list program for the command line. ~a does not use any data formats, and cannot remove multiple items at once." config:program-name config:program-name) newline-double tab-half (format "~a is a todo-list program for the command line. ~a does not use any data formats, and cannot remove multiple items at once." program-name program-name) newline-double
"USAGE SYNTAX" newline "USAGE SYNTAX" newline
tab-half (format "~a [command] <args>" config:program-name) newline-double tab-half (format "~a [command] <args>" program-name) newline-double
"COMMANDS AVAILABLE" newline "COMMANDS AVAILABLE" newline
tab-half (car config:initialize-commands) newline tab-half initialize-command newline
tab-full (format "Creates a list file located at ~a" config:list-file) newline-double tab-full (format "Creates a list file located at ~a" list-file) newline-double
tab-half (car config:list-commands) newline tab-half list-command newline
tab-full "Displays items from your list" newline-double tab-full "Displays items from your list" newline-double
tab-half (car config:add-commands) " <args>" newline tab-half add-command " <args>" newline
tab-full "Adds an item to your list" newline-double tab-full "Adds an item to your list" newline-double
tab-half (car config:remove-commands) " <args>" newline tab-half remove-command " <args>" newline
tab-full "Removes an item from your list" newline-double tab-full "Removes an item from your list" newline-double
"USAGE EXAMPLES" newline "USAGE EXAMPLES" newline
tab-half (car config:initialize-commands) newline tab-half initialize-command newline
tab-full (format "~a ~a" config:program-name (car config:initialize-commands)) newline-double tab-full (format "~a ~a" program-name initialize-command) newline-double
tab-half (car config:list-commands) newline tab-half list-command newline
tab-full (format "~a ~a" config:program-name (car config:list-commands)) newline-double tab-full (format "~a ~a" program-name list-command) newline-double
tab-half (car config:add-commands) newline tab-half add-command newline
tab-full (format "~a ~a this is an item without double quotation marks" config:program-name (car config:add-commands)) newline tab-full (format "~a ~a this is an item without double quotation marks" program-name add-command) newline
tab-full (format "~a ~a \"this is an item surrounded by double quotation marks\"" config:program-name (car config:add-commands)) newline-double tab-full (format "~a ~a \"this is an item surrounded by double quotation marks\"" program-name add-command) newline-double
tab-half (car config:remove-commands) newline tab-half remove-command newline
tab-full (format "~a ~a 2" config:program-name (car config:remove-commands)) newline-double tab-full (format "~a ~a 2" program-name remove-commands) newline-double
"If you can't see the whole help message, then try running the following command: " newline "If you can't see the whole help message, then try running the following command: " newline
tab-half (format "~a ~a | less" config:program-name (car config:help-commands)) newline) tab-half (format "~a ~a | less" program-name help-command)) newline)
'empty-list "> There is nothing in your list\n" 'empty-list "> There is nothing in your list\n"
'show-usage (format "> For usage type ~a -h\n" config:program-name) 'show-usage (format "> For usage type ~a -h\n" program-name)
'creating (format "> Creating a list at ~a...\n" config:list-file) 'creating (format "> Creating a list at ~a...\n" list-file)
'creation-error (format "> Error: Could not create a list file at ~a\n" config:list-file) 'creation-error (format "> Error: Could not create a list file at ~a\n" list-file)
'file-already-exists (format "> Error: A list file already exists at ~a\n" config:list-file) 'file-already-exists (format "> Error: A list file already exists at ~a\n" list-file)
'successfully-created (format "> Your list file was successfully created at ~a\n" config:list-file) 'successfully-created (format "> Your list file was successfully created at ~a\n" list-file)
'file-not-found (format "> Error: Could not find ~a\n" config:list-file) 'file-not-found (format "> Error: Could not find ~a\n" list-file)
'item-not-found "> Error: Could not find that item\n" 'item-not-found "> Error: Could not find that item\n"
'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) 'init-y/n (format "> A list file will be created at ~a\n> Are you sure you want to continue? [y/n]\n" list-file)
'try-init (format "> Try typing the following to setup ~a:\n~a ~a\n" config:program-name config:program-name (car config:initialize-commands)) 'try-init (format "> Try typing the following to setup ~a:\n~a ~a\n" program-name program-name initialize-command)
'terminating (format "> Exited ~a\n" config:program-name) 'terminating (format "> Exited ~a\n" program-name)
'choose-y/n "> Error: Please choose y or n\n" 'choose-y/n "> Error: Please choose y or n\n"
@ -86,5 +94,6 @@
'item-removed "> Removed \"~a\" from your list\n")) 'item-removed "> Removed \"~a\" from your list\n"))
(define y/n (hash 'yes '("yes" "Yes" "y" "Y") (define y/n
'no '("no" "No" "n" "N"))) (hash 'yes '("yes" "Yes" "y" "Y")
'no '("no" "No" "n" "N")))