From 9defa737f4351f639882f0576cbafdd0de71f1fd Mon Sep 17 00:00:00 2001 From: sammyette <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 25 May 2021 20:05:11 -0400 Subject: [PATCH] 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 --- shell.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/shell.go b/shell.go index 10d8ff7..f710264 100644 --- a/shell.go +++ b/shell.go @@ -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)