diff options
author | Simon Parri <simonparri@ganzeria.com> | 2025-07-22 00:56:22 +0200 |
---|---|---|
committer | Simon Parri <simonparri@ganzeria.com> | 2025-07-22 11:49:01 +0200 |
commit | d2c331b9f036951eef062dd5141c75182375ba12 (patch) | |
tree | 325bf3c56b70ec845e8de9349f45408ed844e747 /common/bin/rb | |
download | dotfiles-d2c331b9f036951eef062dd5141c75182375ba12.tar.gz dotfiles-d2c331b9f036951eef062dd5141c75182375ba12.zip |
Add current configuration
Diffstat (limited to 'common/bin/rb')
-rwxr-xr-x | common/bin/rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/bin/rb b/common/bin/rb new file mode 100755 index 0000000..980016b --- /dev/null +++ b/common/bin/rb @@ -0,0 +1,14 @@ +#!/usr/bin/ruby +# Taken from https://github.com/thisredone/rb + +File.join(Dir.home, '.rbrc').tap { |f| load f if File.exist?(f) } + +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) |