Support piping from command line to redcar commant
Reported by Charles Oliver Nutter | May 2nd, 2010 @ 06:35 PM
One of my most frequent uses of Textmate is as a target of piped text. I would like to be able to do this in redcar:
$ ls | redcar
This shouldn't be too hard; you either hold the data in memory or write it quickly to a tempfile (Textmate appears to do this, probably since it's easier than piping the data from the command to the running app).
Comments and changes to this ticket
-
Charles Oliver Nutter May 2nd, 2010 @ 07:07 PM
Here's my hack to make it work for the moment (in bin/redcar):
... installer = Redcar::Installer.new installer.associate_with_any_right_click else # if no ARGV.first, try to load stdin to a temporary file unless ARGV[0] data = "" begin chunk = $stdin.read_nonblock(1024) data << chunk while chunk chunk = $stdin.read_nonblock(1024) data << chunk end rescue Errno::EAGAIN retry rescue EOFError end if data.size > 0 require 'tmpdir' file = File.join(Dir.tmpdir, "tmp#{$$}.txt") File.open(file, 'w') {|f| f.write data} ARGV.unshift file #todo: editor should wipe out tmpfile on close end end exit if Redcar.try_to_load_via_drb require File.join(File.dirname(__FILE__), %w(.. lib redcar)) ...
-
Charles Oliver Nutter May 3rd, 2010 @ 09:49 PM
FYI, my hack above seems to break starting redcar with no arguments, so it's not quite there.
-
Daniel Lucraft June 5th, 2010 @ 12:26 PM
This is in git as of: http://github.com/danlucraft/redcar/commit/c89541988079c22c1576bad3... and will be in 0.3.6
-
Daniel Lucraft June 5th, 2010 @ 12:29 PM
- State changed from new to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A programmer's text editor for Gnome.