Boss mode

This commit is contained in:
aerth
2016-04-19 04:33:54 +00:00
parent c264fec472
commit a2ca47a496
3 changed files with 28 additions and 3 deletions

View File

@@ -2,10 +2,28 @@ package main
import (
"os"
"os/exec"
"regexp"
"strings"
)
func HandleShellCommand(input string, view *View) {
inputCmd := strings.Split(input, " ")[0]
args := strings.Split(input, " ")[1:]
// Execute Command
cmdout := exec.Command(inputCmd, args...)
output, err := cmdout.Output()
if err != nil {
messenger.Error("Error: " + err.Error())
return
}
// Display last line of output
messenger.Message(string(output))
}
// HandleCommand handles input from the user
func HandleCommand(input string, view *View) {
inputCmd := strings.Split(input, " ")[0]