fix: check aliases before going to sh interp

pull/61/head
sammyette 2021-06-09 19:16:08 -04:00
parent 14064eceda
commit 95dee1f4dd
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,17 @@ import (
func RunInput(input string) { func RunInput(input string) {
cmdArgs, cmdString := splitInput(input) cmdArgs, cmdString := splitInput(input)
// If alias was found, use command alias
for aliases[cmdArgs[0]] != "" {
alias := aliases[cmdArgs[0]]
cmdString = alias + strings.TrimPrefix(cmdString, cmdArgs[0])
cmdArgs, cmdString = splitInput(cmdString)
if aliases[cmdArgs[0]] != "" {
continue
}
}
// First try to load input, essentially compiling to bytecode // First try to load input, essentially compiling to bytecode
fn, err := l.LoadString(cmdString) fn, err := l.LoadString(cmdString)
if err != nil && noexecute { if err != nil && noexecute {