2
2
дзеркало https://github.com/Hilbis/Hilbish synced 2025-07-06 19:12:02 +00:00

Порівняти коміти

...

2 Коміти

Автор SHA1 Повідомлення Дата
sammyette
e4833bdba9
feat: add command.preexec hook
it provides 2 arguments: what the user typed, and the command hilbish
will execute.
2021-10-14 08:51:29 -04:00
sammyette
63061e3a52
fix(bait): allow more than 1 argment for catch callback 2021-10-13 23:41:20 -04:00
2 змінених файлів з 2 додано та 1 видалено

@ -30,6 +30,6 @@ func (b *Bait) throw(name string, args ...interface{}) {
b.Em.Emit(name, args...) b.Em.Emit(name, args...)
} }
func (b *Bait) catch(name string, catcher func(interface{})) { func (b *Bait) catch(name string, catcher func(...interface{})) {
b.Em.On(name, catcher) b.Em.On(name, catcher)
} }

@ -31,6 +31,7 @@ func RunInput(input string) {
continue continue
} }
} }
hooks.Em.Emit("command.preexec", input, cmdString)
// First try to load input, essentially compiling to bytecode // First try to load input, essentially compiling to bytecode
fn, err := l.LoadString(cmdString) fn, err := l.LoadString(cmdString)