add command parameters (as long as there are none)

main
Daniel Barlow 2022-12-19 21:01:10 +00:00
parent 38786d3790
commit 102afaa90e
2 changed files with 8 additions and 3 deletions

View File

@ -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)))

View File

@ -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