mirror of
https://gitlab.com/pnx/gosh
synced 2026-06-16 07:04:57 +02:00
18 lines
299 B
Go
18 lines
299 B
Go
package builtins
|
|
|
|
import (
|
|
"gosh/internal/builtins/cd"
|
|
"gosh/internal/builtins/exit"
|
|
)
|
|
|
|
type builtinFn func([]string) error
|
|
|
|
var registry = map[string]builtinFn{
|
|
"cd": cd.Exec,
|
|
"exit": exit.Exec,
|
|
}
|
|
|
|
func Lookup(program string) (builtinFn, bool) {
|
|
fn, ok := registry[program]
|
|
return fn, ok
|
|
}
|