fix!: remove recursive aliases

i dont think this is really useful and since the `args` provided
by the sh interp dont include quotes i can't split with our own
function, which is a problem
i also removed running lua code like a sh command, now its only
entire input for lua; like it was before
pull/59/head
sammyette 2021-05-25 20:05:11 -04:00
parent b608ea6bc8
commit 9defa737f4
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 3 additions and 12 deletions

View File

@ -107,17 +107,13 @@ func execCommand(cmd string) error {
exechandle := func(ctx context.Context, args []string) error {
hc := interp.HandlerCtx(ctx)
args, argstring := splitInput(strings.Join(args, " "))
_, argstring := splitInput(strings.Join(args, " "))
// If alias was found, use command alias
for aliases[args[0]] != "" {
if aliases[args[0]] != "" {
alias := aliases[args[0]]
argstring = alias + strings.TrimPrefix(argstring, args[0])
args, argstring = splitInput(argstring)
if aliases[args[0]] != "" {
continue
}
args[0] = alias
}
// If command is defined in Lua then run it
@ -148,11 +144,6 @@ func execCommand(cmd string) error {
return interp.NewExitStatus(exitcode)
}
err := l.DoString(argstring)
if err == nil {
return nil
}
if _, err := interp.LookPathDir(hc.Dir, hc.Env, args[0]); err != nil {
hooks.Em.Emit("command.not-found", args[0])
return interp.NewExitStatus(127)