Some improvements on external tools #34

Closed
wants to merge 3 commits into
from
@@ -173,8 +173,9 @@ def on_finish():
if tool.output == 'to-console':
from snaked.core.console import consume_output
- proc.stdin.write(stdin)
- proc.stdin.close()
+ if proc.stdin:
+ proc.stdin.write(stdin)
+ proc.stdin.close()
consume_output(editor, proc, on_finish)
else:
stdout, stderr = proc.communicate(stdin)
@@ -13,7 +13,7 @@
# or session context.
#
# input is one of:
-#
+# none : pipes nothing to script
# from-buffer : pipes whole buffer to script
# from-selection : pipes only current selection
# from-buffer-or-selection : pipes selection if exists and buffer otherwise.
@@ -31,6 +31,12 @@
#
# I think it self-explanatory.
#
+# In the shell commands there are a few additional environment variables
+# available:
+#
+# $FILENAME : name of currently active file
+# $OFFSET
+#
# Here some examples:
tool "_Run" for "python" from-buffer to-console
@@ -39,4 +45,6 @@ tool "_Run" for "python" from-buffer to-console
tool "Sphinx _make" for "session:myproject" to-console
cd doc
make html
-
+
+tool "JSLint" for "js" none to-console
+ jslint $FILENAME