tylerl / filterpipes Goto Github PK
View Code? Open in Web Editor NEWSend text to shell command or custom filters [ST2/ST3]
License: Apache License 2.0
Send text to shell command or custom filters [ST2/ST3]
License: Apache License 2.0
I try formatting via xmllint --format
but to no avail. xmllint
accepts input either via filename (last position on command-line) or via stdin
. Then the typical "-"
must be added. I tried with and without "-"
. I also tried setting shell
to true
and put all into a single string ("xmllint --format"
with and without "-"
) but that tries to parse the whole string as the command's path/name, which, of course, breaks.
If I leave out the "-"
, then I get the usage message of the xmllint
command in return (but nothing else). If I add the "-"
then nothing happens and FitlerPipes
signals: Nothing changed. So, currently I have this:
{
"caption": "FilterPipes: Format XML (xmllint)",
"command": "filter_pipes_process",
"args": { "command": ["xmllint", "--format", "-"] }
}
but that does not work out as I would have expected. As a sidenote: I am on Win10 with Cygwin installed (that's the verision of xmllint
I use). Thanks.
Hi,
I am using Sublime3 on Windows7 and Python 2.7 as default Python. The external command I try to run identifies as: "HTML Tidy for Cygwin released on 1st September 2004". There is no newer version for Cygwin.
If no output filepath is given to Tidy, it returns the tidied document on STDOUT. However, it also may dump a lot of errors and warnings (even if an output file name has been set). This, however, can be switched off by setting an error file. Thus my configuration for this FilterPipe is:
{
"caption": "FilterPipes: Tidy up (XHTML)",
"command": "filter_pipes_process",
"args": {
"command": ["tidy", "-config", "C:\\Users\\bmix\\tidy-xhtmlize.cfg", "-f", "tidy-errs.txt"],
"shell": false
}
},
SublimeText 3's console reports:
Error 2 executing command [tidy -config C:\Users\bmix\tidy-xhtmlize.cfg -f tidy-errs.txt]:
b''
I can confirm, that FilterPipes passes the editor's text to Tidy (I saw parts of Tidy's error-report on the document when I left out the errs.txt re-routing). What I do not understand, however, is, that there is no result back, the text within the editor stays the same, rather than being replaced with Tidy's output. I also do not understand the letter "b" with the two single-quote characters.
I've tried several ways to do it, but haven't been able to get it to work yet. Basically, I'm trying to pipe the output from the figlet
command processing the selected text through sed to add comment characters at the start of the 'bannerized' text, and then want to pipe that through tr (yes, I'm one of those nerds who use it) to replace some characters. e. g.:
figlet -f banner | sed '/^/--/' | tr '# ' 'โโ'
Hopefully someone will see this and can help me figure out how to get the syntax right to make this work.
And thank you @tylerl for a great package/plugin!!!
EDIT: I just googled a bit more on this & found something that might work.
"The $(...) shell operator executes the command within parentheses and substitutes its output into the command line."
Going to try using this method to send the other commands/arguments as strings. Hopefully that'll work & I can close this report.
EDIT2: doesn't seem to work for tr as it won't take the text selection as an argument, and only seems to operate on files passed to it's stdin, or text passed from output of another function.
I could really use some help with this one. I'm all googled out on it.
EDIT 3: Finally figured out out! By using another ST package called multicommand
(which will receive & parse other Sublime Text commands & the arguments to them, & execute them in sequence from a single command), I was able to set the primary command in the default .sublime-commands file for FilterPipes to the multicommand, then used that to execute the various other shell & FilterPipes commands I needed to turn a basic text string into either a commented banner in the source script, an assigned variable for a target app's tooltip, or whatever else I might need to do with it.
Hi,
Is there a possibility to haven't/remove extra CR after excecute a filter?
My goal is to solve the issue I had reported on ascii-boxes on this issues
Would it be possible to implement a command history for this plugin? I went searching and while I don't understand plugin architecture very well I found somebody asking for the same thing:
http://www.sublimetext.com/forum/viewtopic.php?f=6&t=14777&p=59099&hilit=show_input_panel#p59099
It seems that it might be possible?
May I propose another setting, that defines the current-working directory for any external command to run?
Related to my previous issue #1, where I had to run an external command, whose output may result in two different files, one being an error-report, I would like to propose a switch, that would tell FilterPipes to open a named file after a filter-run (in this case the error-report).
When a program 'Tidy' gets run with an option '-f filespec', then all errors and warnings, that may result from this run will end up in a file designated under 'filespec'. This is in addition to the actual result of the command, which, in this case, would be a modified version of the input-document.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.