Andre Nathan
10/16/2006 2:10:00 PM
Hi
I was quite bored this morning and the coffee machine went into its 30
minute clean cycle, so I came up with this...
$ cat .irbrc
Dir["{,/usr,/usr/local}/bin/*"].each do |bin|
Object.instance_eval do
define_method(File.basename(bin)) do |*args|
args.map! { |arg| arg.to_s }
system bin, *args
end
end
end
$ irb --simple-prompt
irb: warn: can't alias kill from irb_kill.
>> touch :foo
=> true
>> mv :foo, :bar
=> true
>> ls "-l", :bar
-rw-r--r-- 1 andre andre 0 Oct 16 11:56 bar
=> true
>>
Probably useless, I know... but running "vim :foo.rb" or "top" from
inside irb is cool :P
Andre