mirror of
https://github.com/hymkor/lispect.git
synced 2026-10-27 05:49:57 -04:00
Implement $EXECUTABLE_NAME
This commit is contained in:
1 parent
ab0e2b12a3
commit
9c73fd4215
1 file changed
+7
-2
@@ -54,9 +54,14 @@ 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))
|
||||||
}
|
}
|
||||||
|
executable := os.Args[0]
|
||||||
|
if value, err := os.Executable(); err == nil {
|
||||||
|
executable = value
|
||||||
|
}
|
||||||
lisp = lisp.Let(gmnlisp.Variables{
|
lisp = lisp.Let(gmnlisp.Variables{
|
||||||
gmnlisp.NewSymbol("args"): gmnlisp.List(posixArgv...),
|
gmnlisp.NewSymbol("args"): gmnlisp.List(posixArgv...),
|
||||||
gmnlisp.NewSymbol("$PROGRAM_NAME"): gmnlisp.String(args[0]),
|
gmnlisp.NewSymbol("$PROGRAM_NAME"): gmnlisp.String(args[0]),
|
||||||
|
gmnlisp.NewSymbol("$EXECUTABLE_NAME"): gmnlisp.String(executable),
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|||||||
Reference in new issue
Block a user