File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# ## ————————————————————————————————————————————————————————————————————————————————————————————————
22# ## This module implements the list contacts command.
33
4+ (import ../utils :prefix " " )
45(import ../date :as d )
56(import ../contact/repository :as contacts_repository )
67
1819 (print (to-csv-line contact )))
1920 plan )
2021
21- (defn- format-command-errors [command errors ]
22- (map (fn [error ] (string command " " (string/ascii-lower error ) " ." )) errors ))
23-
2422# # —————————————————————————————————————————————————————————————————————————————————————————————————
2523# # Public Interface
2624
Original file line number Diff line number Diff line change 11# ## ————————————————————————————————————————————————————————————————————————————————————————————————
22# ## This module implements a command for scheduling contacts for today in a plan.
33
4+ (import ../utils :prefix " " )
5+
46(import ../contact )
57(import ../date )
68(import ../day )
5153(defn- schedule-birthday-tasks [plan contacts today ]
5254 (schedule-tasks plan contacts today birthday-prefix contact/birthday? ))
5355
54- (defn- format-command-errors [command errors ]
55- (map (fn [error ] (string command " " (string/ascii-lower error ) " ." )) errors ))
56-
5756# # —————————————————————————————————————————————————————————————————————————————————————————————————
5857# # Public Interface
5958
Original file line number Diff line number Diff line change 11# ## ————————————————————————————————————————————————————————————————————————————————————————————————
22# ## This module implements a command for scheduling days for today in a plan.
33
4+ (import ../utils :prefix " " )
5+
46(import ../date )
57(import ../day )
68(import ../plan )
4951 (task/mark-as-missed task (day :date ))))
5052 tasks ))
5153
52- (defn- format-errors [errors ]
53- (map (fn [error ] (string command " " (string/ascii-lower error ) " ." )) errors ))
54-
5554# # —————————————————————————————————————————————————————————————————————————————————————————————————
5655# # Public Interface
5756
7473 (let [load-file-result (file_repository/load argument )
7574 errors (load-file-result :errors )]
7675 (if errors
77- {:errors (format-errors errors )}
76+ {:errors (format-command- errors command errors )}
7877 (let [parse-result (schedule_parser/parse (load-file-result :text ))
7978 errors (parse-result :errors )]
8079 (if errors
81- {:errors (format-errors errors )}
80+ {:errors (format-command- errors command errors )}
8281 {:command [schedule-tasks (parse-result :tasks ) (date/today )]}))))
8382 {}))
Original file line number Diff line number Diff line change 11# ## ————————————————————————————————————————————————————————————————————————————
22# ## This module implements stats command.
33
4- (import ../utils :as " u " )
4+ (import ../utils :prefix " " )
55(import ../plan )
66
77# # —————————————————————————————————————————————————————————————————————————————
1212 Prints stats for the plan. Returns the plan.
1313 ```
1414 [plan ]
15- (print (u/ pluralize (length (plan :days )) " day" ))
16- (print (u/ pluralize (length (plan/completed-tasks plan )) " completed task" ))
17- (print (u/ pluralize (length (plan/pending-tasks plan )) " pending task" ))
15+ (print (pluralize (length (plan :days )) " day" ))
16+ (print (pluralize (length (plan/completed-tasks plan )) " completed task" ))
17+ (print (pluralize (length (plan/pending-tasks plan )) " pending task" ))
1818 plan )
1919
2020(defn build-command [arguments & ]
Original file line number Diff line number Diff line change 11# ## ————————————————————————————————————————————————————————————————————————————————————————————————
22# ## This module implements a repository that loads contacts from Markdown files.
33
4- (import ../file_repository )
54(import ../utils )
5+
6+ (import ../file_repository )
67(import ./parser :as contact_parser )
78
89(defn- load-contact [contact-path ]
Original file line number Diff line number Diff line change 1313 (if (string/has-suffix? " /" path )
1414 (string/trimr path " /" )
1515 path ))
16+
17+ (defn format-command-errors [command errors ]
18+ (map (fn [error ] (string command " " (string/ascii-lower error ) " ." )) errors ))
You can’t perform that action at this time.
0 commit comments