diff --git a/code/commands.go b/code/commands.go index b1ea387a..1c63a0d1 100644 --- a/code/commands.go +++ b/code/commands.go @@ -126,9 +126,9 @@ func (cm *CmdAndArgs) PrepCmd(avp *ArgVarVals) (*exec.Cmd, string) { switch cm.Cmd { case "{PromptString1}": // special case -- expand args cmdstr := cstr - args, err := shellwords.Parse(cmdstr) - if err != nil { - fmt.Println(err) + args := errors.Log1(shellwords.Parse(cmdstr)) + if len(args) == 0 { + return nil, "" } if len(args) > 1 { cstr = args[0] @@ -482,6 +482,9 @@ func (cm *Command) RunAfterPrompts(cv *Code, buf *texteditor.Buffer) { // line of the command output to code statusbar func (cm *Command) RunBufWait(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool { cmd, cmdstr := cma.PrepCmd(&cv.ArgVals) + if cmd == nil { + return false + } cv.RunningCmds.AddCmd(cm.Label(), cmdstr, cma, cmd) out, err := cmd.CombinedOutput() cm.AppendCmdOut(cv, buf, out) @@ -492,6 +495,9 @@ func (cm *Command) RunBufWait(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) // buffer with new results line-by-line as they come in func (cm *Command) RunBuf(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool { cmd, cmdstr := cma.PrepCmd(&cv.ArgVals) + if cmd == nil { + return false + } cv.RunningCmds.AddCmd(cm.Label(), cmdstr, cma, cmd) stdout, err := cmd.StdoutPipe() if err == nil { diff --git a/go.mod b/go.mod index 4ee3d29c..3fc0985f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module cogentcore.org/cogent go 1.22 require ( - cogentcore.org/core v0.3.3-0.20240902172924-b432919e181b + cogentcore.org/core v0.3.3-0.20240902213628-48df10901467 github.com/aandrew-me/tgpt/v2 v2.7.2 github.com/alecthomas/chroma/v2 v2.13.0 github.com/bogdanfinn/fhttp v0.5.27 diff --git a/go.sum b/go.sum index b9efcc64..1b6cbe58 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -cogentcore.org/core v0.3.3-0.20240902172924-b432919e181b h1:G7CC9jK/8FWCOYrc83VR5raE82xCkTlG3/h63txQ5Pw= -cogentcore.org/core v0.3.3-0.20240902172924-b432919e181b/go.mod h1:dg3uRsPcd8S1ZYvRD2TztCtjopRkrB5V/lbl54xsQd4= +cogentcore.org/core v0.3.3-0.20240902213628-48df10901467 h1:AL9pi5H1ttL76EpnqBCCaflNnfwRxuezZOApoSOL564= +cogentcore.org/core v0.3.3-0.20240902213628-48df10901467/go.mod h1:dg3uRsPcd8S1ZYvRD2TztCtjopRkrB5V/lbl54xsQd4= github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4 h1:6lx9xzJAhdjq0LvVfbITeC3IH9Fzvo1aBahyPu2FuG8= github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4/go.mod h1:FChzXi1izqzdPb6BiNZmcZLGyTYiT61iGx9Rxx9GNeI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=