mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-11 15:12:47 +09:00
boss mode: Single line output stays in messenger, multiline output goes to a help-style screen
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user