... | ... |
@@ -30,17 +30,19 @@ |
30 | 30 |
(contains? equipment cmd) (equipment cmd) |
31 | 31 |
:else {:err (str "Unknown command '" cmdline "'")}))) |
32 | 32 |
|
33 |
-(re-frame/reg-event-db |
|
33 |
+(re-frame/reg-event-fx |
|
34 | 34 |
::submit-cmd |
35 |
- (fn-traced [db _] |
|
36 |
- (let [cmdline (-> db (get-in [:cmdline :current]) trim) |
|
35 |
+ (fn [cofx _] |
|
36 |
+ (let [db (cofx :db) |
|
37 |
+ cmdline (-> db (get-in [:cmdline :current]) trim) |
|
37 | 38 |
not-empty? seq] |
38 |
- ; TODO replace this with a "->when" macro so that we |
|
39 |
- ; don't always have to prefix with a conditional |
|
40 |
- (cond-> db |
|
41 |
- true (update-in [:cmdline :current] (constantly nil)) |
|
42 |
- (not-empty? cmdline) |
|
43 |
- (as-> db |
|
44 |
- (let [output (execute db cmdline)] |
|
45 |
- (update-in db [:cmdline :history] conj |
|
46 |
- {:input cmdline :output output}))))))) |
|
39 |
+ {:db |
|
40 |
+ ; TODO replace this with a "->when" macro so that we |
|
41 |
+ ; don't always have to prefix with a conditional |
|
42 |
+ (cond-> db |
|
43 |
+ true (update-in [:cmdline :current] (constantly nil)) |
|
44 |
+ (not-empty? cmdline) |
|
45 |
+ (as-> db |
|
46 |
+ (let [output (execute db cmdline)] |
|
47 |
+ (update-in db [:cmdline :history] conj |
|
48 |
+ {:input cmdline :output output}))))}))) |