18 lines
366 B
Fennel
18 lines
366 B
Fennel
(local { : Gtk } (require :lgi))
|
|
|
|
(local commands {})
|
|
|
|
(fn define-command [name function params]
|
|
(let [v {:name name :function function :params params}]
|
|
(tset commands name v)))
|
|
|
|
(define-command "quit-browser" #(Gtk.main_quit) {})
|
|
|
|
(fn invoke [s]
|
|
(match (. commands s)
|
|
{:function f :params p} (f)
|
|
nil (print "undefined command " s)))
|
|
|
|
|
|
{ : invoke }
|