From f3e9271cae5a2ab064645ff1395f4e0d9ae10d8c Mon Sep 17 00:00:00 2001 From: aerth Date: Tue, 19 Apr 2016 05:10:53 +0000 Subject: [PATCH] boss mode: Single line output stays in messenger, multiline output goes to a help-style screen --- cmd/micro/command.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cmd/micro/command.go b/cmd/micro/command.go index b49491ed..2c6f1ecf 100644 --- a/cmd/micro/command.go +++ b/cmd/micro/command.go @@ -15,20 +15,17 @@ func HandleShellCommand(input string, view *View) { // Execute Command cmdout := exec.Command(inputCmd, args...) - output, err := cmdout.Output() - if err != nil { - messenger.Error("Error: " + err.Error()) + output, _ := cmdout.CombinedOutput() + outstring := string(output) + totalLines := strings.Split(outstring, "\n") + if len(totalLines) == 2 { + messenger.Message(outstring) return } - outstring := string(output) - - // Display last line of output if not empty if outstring != "" { + // Display nonblank output DisplayBlock(outstring) - // } else { - // messenger.Message("No errors.") } - } // DisplayBlock displays txt