mirror of
https://github.com/hymkor/lispect.git
synced 2026-09-02 15:17:49 -04:00
Implement $EXECUTABLE_NAME
This commit is contained in:
@@ -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