add rb wrapper script

weechat-localhost
Ben Harris 2018-08-20 11:36:02 -04:00
parent 2660491760
commit 4f3acdf59d
1 changed files with 12 additions and 0 deletions

12
bin/bin/rb 100755
View File

@ -0,0 +1,12 @@
#!/usr/bin/env ruby
def execute(_, code)
puts _.instance_eval(&code)
rescue Errno::EPIPE
exit
end
single_line = ARGV.delete('-l')
code = eval("Proc.new { #{ARGV.join(' ')} }")
single_line ? STDIN.each { |l| execute(l.chomp, code) } : execute(STDIN.each_line, code)