#✩‿✩ Filter Through Command A Redcar Editor plugin for manipulating and displaying text using shell commands
Filter Through Command supports running the current line of a document as a shell script, as well as manipulating and displaying text using several options for input and output.
##Installation
Version 1.0 supports Redcar 0.8 and above, versions 1.1 and beyond support Redcar 0.12 and above only.
###Redcar v0.12 and above
gem install redcar-filter-through-command
alternately, you can install from source:
###Redcar v0.8 to v0.11
Download a build from the Downloads section and copy to ~/.redcar/plugins, or build from source:
cd ~/.redcar/plugins
git clone git://github.com/kattrali/redcar-filter-through-command.git filter_through_command
git fetch origin --tags
git checkout 1.0 # or 1.1, etc
##Usage
Running the current line or selection as a shell script
Select Plugins > Filter Through Command > Evaluate Text to run the cursor line or selection as a shell script.

Filtering text through a shell script
Select Plugins > Filter Through Command > Open Speedbar... to view command filtering options.
Press the Execute button or press Return in the Command field to run a shell command with the selected options. To rerun the last used filter options, select Plugins > Filter Through Command > Re-run Last Filter, or use the keyboard shortcuts.
Autocompletion is available for recently run commands, and the 10 most recent commands are available from the Command menu.
####Input Options
| None | Run a command without input |
| Cursor Line | Run a command using the text of the cursor line as input |
| Cursor Word | Run a command with the word containing the cursor as input |
| Document | Run a command with all of the text of the current document given as input |
| Selection | Run a command with the selected text or the cursor line text given as input |
####Output Options
| Create new Document | Insert output into a new document |
| Discard | Ignore output |
| Insert as Text | Insert output into the current document at the cursor |
| Open as URL | Open the output in a web browser as a URL |
| Replace Document | Replace the entire document with output |
| Replace Selection | Replace the selected text with output |
| Show as HTML | Open the output in a new HtmlTab or in the default browser |
| Show as Popup | Open the output in a popup dialog under the selected text or cursor line |
| Show as HTML Popup | Open the output in a popup dialog formatted as HTML |
####Variable Substitution
Filter through Command also provides substitution variables for commonly needed text in commands. Substitutions can be further shortened to # + lower case first letter. (Scope being the exception, instead using #c.)
| DOCUMENT (#d) | All of the text of the current document |
| LINE (#l) | Text of the cursor line |
| FILE_PATH (#f) | The file path to the current document |
| SELECTION (#s) | Text of the current selection |
| TEMP (#t) | A new empty file, which is afterwards opened by Redcar |
| WORD (#w) | Text of the word containing the cursor |
| SCOPE (#c) | The current scope of the cursor |
##Extending this Plugin
Additional output types can be added by subclassing FilterCommand::OutputFormat and implementing the supported_types and format(text,type) methods, then including the new class in a Redcar plugin. Examples can be found in lib/filter_command/formats.
##Screenshots


Converting HTML to Haml

HTML Output

Popup Output

HTML Popup

Autocompletion

Using Variable Substitution