Created
April 23, 2011 03:55
-
-
Save miguelbaldi/938249 to your computer and use it in GitHub Desktop.
Configuration tool for formatting javascript within gEdit (using 'External Tools' gEdit plugin)
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
#!/usr/bin/env python | |
import os | |
import sys | |
import tempfile | |
jsbeautifier_home = "/home/miguel/dev/javascript/js-beautify/" | |
content = sys.stdin.read() | |
h, tmpfile = tempfile.mkstemp() | |
os.close(h) | |
f = open(tmpfile, "w") | |
f.write(content) | |
f.close() | |
cmd = "python python/jsbeautifier.py -s 4 %s"%(tmpfile) | |
os.chdir(jsbeautifier_home) | |
content = os.system(cmd) | |
os.remove(tmpfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment