mirror of
https://github.com/dragonheim/gagent.git
synced 2025-05-24 21:36:48 -07:00
fix: (issues/9) Worker does not support port assignment for routers (#11)
Quite a refactor and some code cleanup. Co-authored-by: James Wells <jwells@dragonheim.net> Reviewed-on: #11 Co-authored-by: James Wells <jwells@noreply.localhost> Co-committed-by: James Wells <jwells@noreply.localhost>
This commit is contained in:
parent
881a11316d
commit
7d6fbfef24
21 changed files with 451 additions and 271 deletions
27
src/picol/README.md
Normal file
27
src/picol/README.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
# picol.go
|
||||
|
||||
Original http://oldblog.antirez.com/post/picol.html
|
||||
|
||||
Sample use:
|
||||
```golang
|
||||
func CommandPuts(i *picol.Interp, argv []string, pd interface{}) (string, error) {
|
||||
if len(argv) != 2 {
|
||||
return "", fmt.Errorf("Wrong number of args for %s %s", argv[0], argv)
|
||||
}
|
||||
fmt.Println(argv[1])
|
||||
return "", nil
|
||||
}
|
||||
...
|
||||
interp := picol.InitInterp()
|
||||
// add core functions
|
||||
interp.RegisterCoreCommands()
|
||||
// add user function
|
||||
interp.RegisterCommand("puts", CommandPuts, nil)
|
||||
// eval
|
||||
result, err := interp.Eval(string(buf))
|
||||
if err != nil {
|
||||
fmt.Println("ERROR", err, result)
|
||||
} else {
|
||||
fmt.Println(result)
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue