mirror of
https://github.com/hymkor/lispect.git
synced 2026-09-02 15:17:49 -04:00
Implement $PROGRAM_NAME for script name
This commit is contained in:
@@ -54,7 +54,10 @@ func mains(args []string) error {
|
|||||||
for _, s := range args[1:] {
|
for _, s := range args[1:] {
|
||||||
posixArgv = append(posixArgv, gmnlisp.String(s))
|
posixArgv = append(posixArgv, gmnlisp.String(s))
|
||||||
}
|
}
|
||||||
lisp = lisp.Let(&gmnlisp.Pair{Key: gmnlisp.NewSymbol("args"), Value: gmnlisp.List(posixArgv...)})
|
lisp = lisp.Let(gmnlisp.Variables{
|
||||||
|
gmnlisp.NewSymbol("args"): gmnlisp.List(posixArgv...),
|
||||||
|
gmnlisp.NewSymbol("$PROGRAM_NAME"): gmnlisp.String(args[0]),
|
||||||
|
})
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
_, err = lisp.Interpret(ctx, string(script))
|
_, err = lisp.Interpret(ctx, string(script))
|
||||||
|
|||||||
Reference in New Issue
Block a user