Skip to content

Instantly share code, notes, and snippets.

@davidfmiller
Last active April 26, 2017 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidfmiller/1790b90dfbc7781df757e85ff5cc9ac4 to your computer and use it in GitHub Desktop.
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
(* 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