2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-28 08:23:28 +00:00

fix: alias resolution for continued input with quotes

This commit is contained in:
sammyette 2025-04-24 11:27:43 -04:00
parent 80d72a29bb
commit ef4c925e37
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -66,6 +66,8 @@ func (s *Snail) Run(cmd string, strms *util.Streams) (bool, io.Writer, io.Writer
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
//printer := syntax.NewPrinter() //printer := syntax.NewPrinter()
replacer := strings.NewReplacer("[", "\\[", "]", "\\]")
var bg bool var bg bool
for _, stmt := range file.Stmts { for _, stmt := range file.Stmts {
bg = false bg = false
@ -95,7 +97,7 @@ func (s *Snail) Run(cmd string, strms *util.Streams) (bool, io.Writer, io.Writer
_, argstring = splitInput(strings.Join(args, " ")) _, argstring = splitInput(strings.Join(args, " "))
// If alias was found, use command alias // If alias was found, use command alias
argstring = util.MustDoString(s.runtime, fmt.Sprintf(`return hilbish.aliases.resolve("%s")`, argstring)).AsString() argstring = util.MustDoString(s.runtime, fmt.Sprintf(`return hilbish.aliases.resolve [[%s]]`, replacer.Replace(argstring))).AsString()
var err error var err error
args, err = shell.Fields(argstring, nil) args, err = shell.Fields(argstring, nil)