File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99(import ./plan/parser :as plan_parser )
1010(import ./plan/serializer :as plan_serializer )
1111
12- (defn- print-errors [errors ]
13- (each error errors (print (string error " ." ))))
12+ (defn- print-errors [errors exit-status-code ]
13+ (each error errors (print (string error " ." )))
14+ (os/exit exit-status-code ))
1415
1516(def exit-status-codes
1617 {:error 1
17- :plan-path-missing 2 })
18+ :plan-path-missing 2
19+ :file-error 3
20+ :parse-error 4 })
1821
1922# Keep commands sorted alphabetically.
2023(def argparse-params
4649 (def load-file-result (file_repository/load file-path ))
4750 (def errors (load-file-result :errors ))
4851 (if errors
49- (print-errors errors )
52+ (print-errors errors ( exit-status-codes :file-error ) )
5053 (let [plan-string (load-file-result :text )
5154 parse-result (plan_parser/parse plan-string )
5255 parse-errors (parse-result :errors )
5356 plan (parse-result :plan )]
5457 (if parse-errors
55- (print-errors parse-errors )
58+ (print-errors parse-errors ( exit-status-codes :parse-error ) )
5659 (let [serialize-empty-inbox (plan_parser/serialize-empty-inbox? plan-string )
5760 new-plan (run-commands plan file-path arguments )
5861 new-plan-string (plan_serializer/serialize
You can’t perform that action at this time.
0 commit comments