add command parameters (as long as there are none)
This commit is contained in:
parent
38786d3790
commit
102afaa90e
@ -8,9 +8,14 @@
|
|||||||
|
|
||||||
(define-command "quit-browser" #(Gtk.main_quit) {})
|
(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)
|
(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)))
|
nil (print "undefined command " s)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
commander (Gtk.Entry {
|
commander (Gtk.Entry {
|
||||||
:on_activate
|
:on_activate
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(command.invoke event.text))
|
(command.invoke event.text {}))
|
||||||
})
|
})
|
||||||
progress-bar (Gtk.ProgressBar {
|
progress-bar (Gtk.ProgressBar {
|
||||||
:orientation Gtk.Orientation.HORIZONTAL
|
:orientation Gtk.Orientation.HORIZONTAL
|
||||||
|
Loading…
Reference in New Issue
Block a user