Last active
April 26, 2017 19:07
-
-
Save davidfmiller/1790b90dfbc7781df757e85ff5cc9ac4 to your computer and use it in GitHub Desktop.
Pipe `jshint` output of BBEdit's current document into a BBEdit results window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* https://readmeansrun.com *) | |
try | |
tell application "BBEdit" | |
set mydoc to file of (document 1 of window 1) | |
end tell | |
set posixPath to POSIX path of mydoc | |
if (posixPath ends with ".js" or posixPath ends with ".json") then | |
set cmd to "/usr/local/bin/node /usr/local/bin/jshint " & (quoted form of POSIX path of mydoc) & " | /usr/local/bin/bbresults -e --pattern '(?P<file>.+?):\\sline\\s(?P<line>\\d+),\\scol\\s((?P<col>\\d+),)?\\s+(?P<msg>.*)$'" | |
do shell script cmd | |
end if | |
on error | |
beep | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment