How to Show Build Results in OSX Terminal from Sub

2019-05-15 16:39发布

问题:

I just switched to Sublime Text 2 from TextMate, and I absolutely like it a lot. One thing that bothers me is that the default Build Results shows in the bottom part of ST2. My program produces some very long results, and the ideal way to display it (like in TM2) is to see them side by side.

How can I do the same thing with ST2 in Mac OS? I've found this article which talks about how this can be done in Linux. But still couldn't figure out how to adapt it to Mac OS.

Thanks a lot!

回答1:

You can create a shell script that executes the passed input as a Python script in Terminal.app, via osascript, like this:

#!/bin/sh
osascript -e '
    on run parameters
        tell application "Terminal"
            activate
            do script with command "python " & parameters
        end tell
    end run
' $@

Then you can create the build system:

{
    "cmd": ["sh PATH_TO_SHELL_SCRIPT \"$file\""],
    "shell": true
}


回答2:

If you use additional terminal program like iTerm2 you can create a shell script which

  • Opens a new terminal window

  • Issues an initial command for this window

Controlling the opened iTerm2 window and issuing a terminal command for it (to run build and show the results) can be done through generated and static AppleScript file

I don't know how to do it with stock OSX Terminal.