mirror of https://github.com/Hilbis/Hilbish
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 beforepull/59/head
parent
b608ea6bc8
commit
9defa737f4
15
shell.go
15
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)
|
||||
|
|
Loading…
Reference in New Issue