dunlin/command.fnl

18 lines
366 B
Plaintext
Raw Normal View History

2022-12-19 20:57:23 +00:00
(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 }