mirror of
https://github.com/hymkor/lispect.git
synced 2026-10-27 05:49:57 -04:00
Implement $PROGRAM_NAME for script name
This commit is contained in:
1 parent
3c5630327a
commit
69968caa69
1 file changed
+4
-1
@@ -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