mirror of
https://tildegit.org/ben/dotfiles.git
synced 2025-03-27 00:20:40 +00:00
add rb wrapper script
This commit is contained in:
parent
2660491760
commit
4f3acdf59d
12
bin/bin/rb
Executable file
12
bin/bin/rb
Executable 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user