commit 102afaa90ed861cc84e842ec8d2808cec1ee74a9
parent 38786d3790aa8f16da9f420ceae667c87a5c0f04
Author: Daniel Barlow <dan@telent.net>
Date: Mon, 19 Dec 2022 21:01:10 +0000
add command parameters (as long as there are none)
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/command.fnl b/command.fnl
@@ -8,9 +8,14 @@
(define-command "quit-browser" #(Gtk.main_quit) {})
-(fn invoke [s]
+(fn prompt-missing-args [params explicit-args]
+ explicit-args)
+
+(fn invoke [s args]
(match (. commands s)
- {:function f :params p} (f)
+ {:function f :params p}
+ (let [prompted-args (prompt-missing-args p args)]
+ (f prompted-args))
nil (print "undefined command " s)))
diff --git a/frame.fnl b/frame.fnl
@@ -17,7 +17,7 @@
commander (Gtk.Entry {
:on_activate
(fn [event]
- (command.invoke event.text))
+ (command.invoke event.text {}))
})
progress-bar (Gtk.ProgressBar {
:orientation Gtk.Orientation.HORIZONTAL