From c88d2e3c8fcec98e12be367ad64bfd0e48c3f2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Mon, 23 Oct 2023 07:19:41 +0200 Subject: [PATCH 01/15] Remove unused examples --- test/examples/my-plan.md | 3 --- test/examples/todo-2022-02-10.md | 13 ------------- 2 files changed, 16 deletions(-) delete mode 100644 test/examples/my-plan.md delete mode 100644 test/examples/todo-2022-02-10.md diff --git a/test/examples/my-plan.md b/test/examples/my-plan.md deleted file mode 100644 index f22af81..0000000 --- a/test/examples/my-plan.md +++ /dev/null @@ -1,3 +0,0 @@ -# My Plan - -## 2022-05-12 diff --git a/test/examples/todo-2022-02-10.md b/test/examples/todo-2022-02-10.md deleted file mode 100644 index 713d15e..0000000 --- a/test/examples/todo-2022-02-10.md +++ /dev/null @@ -1,13 +0,0 @@ -# Main TODO - -## Inbox - -## 2020-08-01, Saturday - -- [ ] Develop photos for the grandmother -- [X] Pay bills - -## 2020-07-31, Friday - -- [X] Review open pull requests -- [X] Fix flaky test From 4872a02a1512e1d9f59199a21c3f3bba846e6574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Mon, 23 Oct 2023 07:27:44 +0200 Subject: [PATCH 02/15] Set exit status to 2 when file path is missing --- src/alas.janet | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/alas.janet b/src/alas.janet index db33079..272a17a 100644 --- a/src/alas.janet +++ b/src/alas.janet @@ -62,7 +62,9 @@ (run-with-file-path arguments file-path) (if (arguments "version") (print-version) - (print "Plan file path missing.")))) + (do + (print "Plan file path missing.") + (os/exit 2))))) ## ————————————————————————————————————————————————————————————————————————————————————————————————— ## Public Interface From 7412734e2f01f04a1ed265ac8eab4b946d921d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Mon, 23 Oct 2023 07:30:50 +0200 Subject: [PATCH 03/15] Add table of exit status codes --- src/alas.janet | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/alas.janet b/src/alas.janet index 272a17a..e9aa219 100644 --- a/src/alas.janet +++ b/src/alas.janet @@ -12,6 +12,10 @@ (defn- print-errors [errors] (each error errors (print (string error ".")))) +(def exit-status-codes + {:error 1 + :plan-path-missing 2}) + # Keep commands sorted alphabetically. (def argparse-params ["A command line utility for planning your days" @@ -64,7 +68,7 @@ (print-version) (do (print "Plan file path missing.") - (os/exit 2))))) + (os/exit (exit-status-codes :plan-path-missing)))))) ## ————————————————————————————————————————————————————————————————————————————————————————————————— ## Public Interface From e5abbcb76353fd2b1b5f08af4e03a24bd28379ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Mon, 23 Oct 2023 07:34:28 +0200 Subject: [PATCH 04/15] Set exit status code on file and parse error --- src/alas.janet | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/alas.janet b/src/alas.janet index e9aa219..d8f395b 100644 --- a/src/alas.janet +++ b/src/alas.janet @@ -9,12 +9,15 @@ (import ./plan/parser :as plan_parser) (import ./plan/serializer :as plan_serializer) -(defn- print-errors [errors] - (each error errors (print (string error ".")))) +(defn- print-errors [errors exit-status-code] + (each error errors (print (string error "."))) + (os/exit exit-status-code)) (def exit-status-codes {:error 1 - :plan-path-missing 2}) + :plan-path-missing 2 + :file-error 3 + :parse-error 4}) # Keep commands sorted alphabetically. (def argparse-params @@ -46,13 +49,13 @@ (def load-file-result (file_repository/load file-path)) (def errors (load-file-result :errors)) (if errors - (print-errors errors) + (print-errors errors (exit-status-codes :file-error)) (let [plan-string (load-file-result :text) parse-result (plan_parser/parse plan-string) parse-errors (parse-result :errors) plan (parse-result :plan)] (if parse-errors - (print-errors parse-errors) + (print-errors parse-errors (exit-status-codes :parse-error)) (let [serialize-empty-inbox (plan_parser/serialize-empty-inbox? plan-string) new-plan (run-commands plan file-path arguments) new-plan-string (plan_serializer/serialize From a03fc48bb3eaf9888c70fa058cef53018ffdaf93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 24 Oct 2023 07:18:25 +0200 Subject: [PATCH 05/15] Extract exit status codes to errors module --- src/alas.janet | 13 ++++--------- src/errors.janet | 11 +++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 src/errors.janet diff --git a/src/alas.janet b/src/alas.janet index d8f395b..cef2c3d 100644 --- a/src/alas.janet +++ b/src/alas.janet @@ -5,6 +5,7 @@ (import ./commands :prefix "") +(import ./errors) (import ./file_repository) (import ./plan/parser :as plan_parser) (import ./plan/serializer :as plan_serializer) @@ -13,12 +14,6 @@ (each error errors (print (string error "."))) (os/exit exit-status-code)) -(def exit-status-codes - {:error 1 - :plan-path-missing 2 - :file-error 3 - :parse-error 4}) - # Keep commands sorted alphabetically. (def argparse-params ["A command line utility for planning your days" @@ -49,13 +44,13 @@ (def load-file-result (file_repository/load file-path)) (def errors (load-file-result :errors)) (if errors - (print-errors errors (exit-status-codes :file-error)) + (print-errors errors (errors/exit-status-codes :file-error)) (let [plan-string (load-file-result :text) parse-result (plan_parser/parse plan-string) parse-errors (parse-result :errors) plan (parse-result :plan)] (if parse-errors - (print-errors parse-errors (exit-status-codes :parse-error)) + (print-errors parse-errors (errors/exit-status-codes :parse-error)) (let [serialize-empty-inbox (plan_parser/serialize-empty-inbox? plan-string) new-plan (run-commands plan file-path arguments) new-plan-string (plan_serializer/serialize @@ -71,7 +66,7 @@ (print-version) (do (print "Plan file path missing.") - (os/exit (exit-status-codes :plan-path-missing)))))) + (os/exit (errors/exit-status-codes :plan-path-missing)))))) ## ————————————————————————————————————————————————————————————————————————————————————————————————— ## Public Interface diff --git a/src/errors.janet b/src/errors.janet new file mode 100644 index 0000000..5553a35 --- /dev/null +++ b/src/errors.janet @@ -0,0 +1,11 @@ +### ———————————————————————————————————————————————————————————————————————————————————————————————— +### Errors. + +## ————————————————————————————————————————————————————————————————————————————————————————————————— +## Public Interface + +(def exit-status-codes + {:error 1 + :plan-path-missing 2 + :file-error 3 + :parse-error 4}) From 38ab13e6f370b063e29f8551d4aee732bb338854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 24 Oct 2023 07:19:53 +0200 Subject: [PATCH 06/15] Move print-errors to errors module --- src/alas.janet | 8 ++------ src/errors.janet | 4 ++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/alas.janet b/src/alas.janet index cef2c3d..ec4c1ee 100644 --- a/src/alas.janet +++ b/src/alas.janet @@ -10,10 +10,6 @@ (import ./plan/parser :as plan_parser) (import ./plan/serializer :as plan_serializer) -(defn- print-errors [errors exit-status-code] - (each error errors (print (string error "."))) - (os/exit exit-status-code)) - # Keep commands sorted alphabetically. (def argparse-params ["A command line utility for planning your days" @@ -44,13 +40,13 @@ (def load-file-result (file_repository/load file-path)) (def errors (load-file-result :errors)) (if errors - (print-errors errors (errors/exit-status-codes :file-error)) + (errors/print-errors errors (errors/exit-status-codes :file-error)) (let [plan-string (load-file-result :text) parse-result (plan_parser/parse plan-string) parse-errors (parse-result :errors) plan (parse-result :plan)] (if parse-errors - (print-errors parse-errors (errors/exit-status-codes :parse-error)) + (errors/print-errors parse-errors (errors/exit-status-codes :parse-error)) (let [serialize-empty-inbox (plan_parser/serialize-empty-inbox? plan-string) new-plan (run-commands plan file-path arguments) new-plan-string (plan_serializer/serialize diff --git a/src/errors.janet b/src/errors.janet index 5553a35..b2e5261 100644 --- a/src/errors.janet +++ b/src/errors.janet @@ -9,3 +9,7 @@ :plan-path-missing 2 :file-error 3 :parse-error 4}) + +(defn print-errors [errors exit-status-code] + (each error errors (print (string error "."))) + (os/exit exit-status-code)) From cfdfc25362649eb76078c3b3458aaf6b3f7688b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 24 Oct 2023 07:24:50 +0200 Subject: [PATCH 07/15] Move format-command-errors to errors module --- src/commands/list_contacts.janet | 3 ++- src/commands/schedule_contacts.janet | 3 ++- src/commands/schedule_tasks.janet | 5 +++-- src/errors.janet | 3 +++ src/utils.janet | 3 --- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/commands/list_contacts.janet b/src/commands/list_contacts.janet index 121ede2..eb7a51a 100644 --- a/src/commands/list_contacts.janet +++ b/src/commands/list_contacts.janet @@ -3,6 +3,7 @@ (import ../utils :prefix "") (import ../date :as d) +(import ../errors) (import ../contact/repository :as contacts_repository) (defn- to-csv-line [contact] @@ -35,6 +36,6 @@ (let [load-result (contacts_repository/load-contacts argument) errors (load-result :errors)] (if errors - {:errors (format-command-errors "--list-contacts" errors)} + {:errors (errors/format-command-errors "--list-contacts" errors)} {:command [print-contacts (load-result :contacts)]})) {})) diff --git a/src/commands/schedule_contacts.janet b/src/commands/schedule_contacts.janet index 6ef4b73..9f3f1eb 100644 --- a/src/commands/schedule_contacts.janet +++ b/src/commands/schedule_contacts.janet @@ -1,6 +1,7 @@ ### ———————————————————————————————————————————————————————————————————————————————————————————————— ### This module implements a command for scheduling contacts for today in a plan. +(import ../errors) (import ../utils :prefix "") (import ../contact) @@ -69,6 +70,6 @@ errors (load-result :errors) contacts (load-result :contacts)] (if errors - {:errors (format-command-errors "--schedule-contacts" errors)} + {:errors (errors/format-command-errors "--schedule-contacts" errors)} {:command [schedule-contacts contacts (date/today)]})) {})) diff --git a/src/commands/schedule_tasks.janet b/src/commands/schedule_tasks.janet index e384fc2..0f63c20 100644 --- a/src/commands/schedule_tasks.janet +++ b/src/commands/schedule_tasks.janet @@ -8,6 +8,7 @@ (import ../plan) (import ../task) +(import ../errors) (import ../file_repository) (import ../schedule_parser) @@ -84,10 +85,10 @@ (let [load-file-result (file_repository/load argument) errors (load-file-result :errors)] (if errors - {:errors (format-command-errors command errors)} + {:errors (errors/format-command-errors command errors)} (let [parse-result (schedule_parser/parse (load-file-result :text)) errors (parse-result :errors)] (if errors - {:errors (format-command-errors command errors)} + {:errors (errors/format-command-errors command errors)} {:command [schedule-tasks (parse-result :tasks) (date/today)]})))) {})) diff --git a/src/errors.janet b/src/errors.janet index b2e5261..b7f6fca 100644 --- a/src/errors.janet +++ b/src/errors.janet @@ -13,3 +13,6 @@ (defn print-errors [errors exit-status-code] (each error errors (print (string error "."))) (os/exit exit-status-code)) + +(defn format-command-errors [command errors] + (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) diff --git a/src/utils.janet b/src/utils.janet index 873a099..b4b5ff1 100644 --- a/src/utils.janet +++ b/src/utils.janet @@ -13,6 +13,3 @@ (if (string/has-suffix? "/" path) (string/trimr path "/") path)) - -(defn format-command-errors [command errors] - (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) From 62968a470d132dfae7405cad34789700168429b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 24 Oct 2023 07:26:09 +0200 Subject: [PATCH 08/15] Reorder functions --- src/errors.janet | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/errors.janet b/src/errors.janet index b7f6fca..15add2c 100644 --- a/src/errors.janet +++ b/src/errors.janet @@ -10,9 +10,9 @@ :file-error 3 :parse-error 4}) +(defn format-command-errors [command errors] + (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) + (defn print-errors [errors exit-status-code] (each error errors (print (string error "."))) (os/exit exit-status-code)) - -(defn format-command-errors [command errors] - (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) From f2fbcfee02e635a17097f987559f1278a218e12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 24 Oct 2023 07:30:34 +0200 Subject: [PATCH 09/15] Extract print-errors-without-status-code to errors module --- src/commands.janet | 7 ++----- src/errors.janet | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/commands.janet b/src/commands.janet index dbafa10..b5e50e3 100644 --- a/src/commands.janet +++ b/src/commands.janet @@ -12,6 +12,7 @@ (import ./commands/stats) (import ./date :as d) +(import ./errors) (import ./schedule_parser) # backup command needs to be first @@ -27,10 +28,6 @@ schedule_tasks/build-command stats/build-command]) -(defn- print-errors [errors] - (loop [error :in errors] - (print error))) - ## ————————————————————————————————————————————————————————————————————————————————————————————————— ## Public Interface @@ -51,7 +48,7 @@ (def errors (filter identity (flatten (map (fn [c] (c :errors)) commands)))) (if (any? errors) (do - (print-errors errors) + (errors/print-errors-without-status-code errors) plan) (reduce (fn [new-plan command-and-arguments] (def command (first (command-and-arguments :command))) diff --git a/src/errors.janet b/src/errors.janet index 15add2c..97664ea 100644 --- a/src/errors.janet +++ b/src/errors.janet @@ -13,6 +13,11 @@ (defn format-command-errors [command errors] (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) +# TODO: This function should go away. +(defn print-errors-without-status-code [errors] + (loop [error :in errors] + (print error))) + (defn print-errors [errors exit-status-code] (each error errors (print (string error "."))) (os/exit exit-status-code)) From b4b57a6bbdb96508b9d751a27628a8efb7d523ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Wed, 25 Oct 2023 07:27:03 +0200 Subject: [PATCH 10/15] Return errors from run-commands --- src/commands.janet | 20 ++++++++++---------- test/commands_test.janet | 8 +++++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/commands.janet b/src/commands.janet index b5e50e3..17ff957 100644 --- a/src/commands.janet +++ b/src/commands.janet @@ -43,16 +43,16 @@ (map (fn [build-command] (build-command arguments file-path)) commands))) +# TODO: Replace reduce with something else. (defn run-commands [plan file-path arguments] (def commands (build-commands arguments file-path)) (def errors (filter identity (flatten (map (fn [c] (c :errors)) commands)))) - (if (any? errors) - (do - (errors/print-errors-without-status-code errors) - plan) - (reduce (fn [new-plan command-and-arguments] - (def command (first (command-and-arguments :command))) - (def arguments (drop 1 (command-and-arguments :command))) - (apply command new-plan arguments)) - plan - commands))) + (var new-plan plan) + (if (empty? errors) + (set new-plan (reduce (fn [new-plan command-and-arguments] + (def command (first (command-and-arguments :command))) + (def arguments (drop 1 (command-and-arguments :command))) + (apply command new-plan arguments)) + plan + commands))) + {:plan new-plan :errors errors}) diff --git a/test/commands_test.janet b/test/commands_test.janet index 72ee8ad..83a06ca 100644 --- a/test/commands_test.janet +++ b/test/commands_test.janet @@ -54,8 +54,9 @@ (day/build-day (d/date 2020 8 2) @[] @[(task/build-task "Buy milk" true)])])) (def arguments {"skip-backup" true "remove-empty-days" true "insert-days" "3"}) - (def new-plan (run-commands plan file-path arguments)) + (def {:plan new-plan :errors errors} (run-commands plan file-path arguments)) (def days (new-plan :days)) + (test (empty? errors) true) (test (length days) 4) (test (= (d/+days today 2) ((days 0) :date)) true) (test (= (d/+days today 1) ((days 1) :date)) true) @@ -70,9 +71,10 @@ (day/build-day (d/date 2020 8 2) @[] @[(task/build-task "Buy milk" true)])])) (def arguments {"skip-backup" true "remove-empty-days" true "insert-days" "three"}) - (def new-plan (run-commands plan file-path arguments)) + (def {:plan new-plan :errors errors} (run-commands plan file-path arguments)) (def days (new-plan :days)) (test (length days) 3) (test (= today ((days 0) :date)) true) (test (= (d/date 2020 8 4) ((days 1) :date)) true) - (test (= (d/date 2020 8 2) ((days 2) :date)) true)) + (test (= (d/date 2020 8 2) ((days 2) :date)) true) + (test (= (first errors) "--insert-days argument is not a number.") true)) From 61de0be204206bcefce01ca67db84e067513738b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Wed, 25 Oct 2023 07:34:13 +0200 Subject: [PATCH 11/15] Print command errors --- src/alas.janet | 10 ++++++---- src/errors.janet | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/alas.janet b/src/alas.janet index ec4c1ee..47b54c3 100644 --- a/src/alas.janet +++ b/src/alas.janet @@ -47,12 +47,14 @@ plan (parse-result :plan)] (if parse-errors (errors/print-errors parse-errors (errors/exit-status-codes :parse-error)) - (let [serialize-empty-inbox (plan_parser/serialize-empty-inbox? plan-string) - new-plan (run-commands plan file-path arguments) - new-plan-string (plan_serializer/serialize + (let [{:plan new-plan :errors run-errors} (run-commands plan file-path arguments)] + (if (empty? run-errors) + (let [serialize-empty-inbox (plan_parser/serialize-empty-inbox? plan-string) + new-plan-string (plan_serializer/serialize new-plan {:serialize-empty-inbox serialize-empty-inbox})] - (file_repository/save new-plan-string file-path)))))) + (file_repository/save new-plan-string file-path)) + (errors/print-errors run-errors (errors/exit-status-codes :command-error)))))))) (defn- run-with-arguments [arguments] (def file-path (arguments :default)) diff --git a/src/errors.janet b/src/errors.janet index 97664ea..9aadbca 100644 --- a/src/errors.janet +++ b/src/errors.janet @@ -8,7 +8,8 @@ {:error 1 :plan-path-missing 2 :file-error 3 - :parse-error 4}) + :parse-error 4 + :command-error 5}) (defn format-command-errors [command errors] (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) From 1edfe869570486a6062d61625b5bc7410c9914a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 31 Oct 2023 07:13:06 +0100 Subject: [PATCH 12/15] Use print-errors when plan file path is missing --- src/alas.janet | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/alas.janet b/src/alas.janet index 47b54c3..6ded593 100644 --- a/src/alas.janet +++ b/src/alas.janet @@ -62,9 +62,8 @@ (run-with-file-path arguments file-path) (if (arguments "version") (print-version) - (do - (print "Plan file path missing.") - (os/exit (errors/exit-status-codes :plan-path-missing)))))) + (errors/print-errors ["Plan file path is missing"] + (errors/exit-status-codes :plan-path-missing))))) ## ————————————————————————————————————————————————————————————————————————————————————————————————— ## Public Interface From f35eedb443bd97a199e746ad75b9ce5366fcc4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 31 Oct 2023 07:21:58 +0100 Subject: [PATCH 13/15] Remove comment --- src/commands.janet | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commands.janet b/src/commands.janet index 17ff957..69c9ecc 100644 --- a/src/commands.janet +++ b/src/commands.janet @@ -43,7 +43,6 @@ (map (fn [build-command] (build-command arguments file-path)) commands))) -# TODO: Replace reduce with something else. (defn run-commands [plan file-path arguments] (def commands (build-commands arguments file-path)) (def errors (filter identity (flatten (map (fn [c] (c :errors)) commands)))) From 4d5abeed9187c9aff5dcf982cb06b134e66a225f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 31 Oct 2023 07:23:28 +0100 Subject: [PATCH 14/15] Remove unused function --- src/errors.janet | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/errors.janet b/src/errors.janet index 9aadbca..f4ef8a7 100644 --- a/src/errors.janet +++ b/src/errors.janet @@ -14,11 +14,6 @@ (defn format-command-errors [command errors] (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) -# TODO: This function should go away. -(defn print-errors-without-status-code [errors] - (loop [error :in errors] - (print error))) - (defn print-errors [errors exit-status-code] (each error errors (print (string error "."))) (os/exit exit-status-code)) From 90cb97a68ad6488fa83379e662d4cdd376749feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Stri=C4=8Devi=C4=87?= Date: Tue, 31 Oct 2023 07:26:46 +0100 Subject: [PATCH 15/15] Remove duplicate dot --- src/errors.janet | 2 +- test/commands/list_contacts_test.janet | 2 +- test/commands/schedule_contacts_test.janet | 2 +- test/commands/schedule_tasks_test.janet | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/errors.janet b/src/errors.janet index f4ef8a7..781249d 100644 --- a/src/errors.janet +++ b/src/errors.janet @@ -12,7 +12,7 @@ :command-error 5}) (defn format-command-errors [command errors] - (map (fn [error] (string command " " (string/ascii-lower error) ".")) errors)) + (map (fn [error] (string command " " (string/ascii-lower error))) errors)) (defn print-errors [errors exit-status-code] (each error errors (print (string error "."))) diff --git a/test/commands/list_contacts_test.janet b/test/commands/list_contacts_test.janet index 27deb40..ee531c9 100644 --- a/test/commands/list_contacts_test.janet +++ b/test/commands/list_contacts_test.janet @@ -32,4 +32,4 @@ (deftest "when the directory doesn't exist" (def arguments {"list-contacts" "test/missing-directory"}) (def result (build-command arguments)) - (test (first (result :errors)) "--list-contacts directory does not exist.")) + (test (first (result :errors)) "--list-contacts directory does not exist")) diff --git a/test/commands/schedule_contacts_test.janet b/test/commands/schedule_contacts_test.janet index 5516b8d..d4008c4 100644 --- a/test/commands/schedule_contacts_test.janet +++ b/test/commands/schedule_contacts_test.janet @@ -127,4 +127,4 @@ (def arguments {"schedule-contacts" "test/examples/people"}) (def result (build-command arguments)) (test (nil? (result :command)) true) - (test (first (result :errors)) "--schedule-contacts directory does not exist.")) + (test (first (result :errors)) "--schedule-contacts directory does not exist")) diff --git a/test/commands/schedule_tasks_test.janet b/test/commands/schedule_tasks_test.janet index b637e7f..f7bf229 100644 --- a/test/commands/schedule_tasks_test.janet +++ b/test/commands/schedule_tasks_test.janet @@ -225,16 +225,16 @@ (def arguments {"schedule-tasks" "test/examples/missing-schedule.md"}) (def result (build-command arguments)) (test (nil? (result :command)) true) - (test (first (result :errors)) "--schedule-tasks file does not exist.")) + (test (first (result :errors)) "--schedule-tasks file does not exist")) (deftest "returns an error when the schedule cannot be parsed" (def arguments {"schedule-tasks" "test/examples/unparsable-schedule.md"}) (def result (build-command arguments)) (test (nil? (result :command)) true) - (test (first (result :errors)) "--schedule-tasks schedule can not be parsed.")) + (test (first (result :errors)) "--schedule-tasks schedule can not be parsed")) (deftest "returns an error when the schedule is empty" (def arguments {"schedule-tasks" "test/examples/empty-schedule.md"}) (def result (build-command arguments)) (test (nil? (result :command)) true) - (test (first (result :errors)) "--schedule-tasks schedule is empty.")) + (test (first (result :errors)) "--schedule-tasks schedule is empty"))