Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 38 lines (26 sloc) 681 Bytes
#!/usr/bin/env ruby
# Disclaimer: hacky piece of code follows!
# TODO: maybe use logging
DEBUG = false
$config_file = File.join(ENV['HOME'], '.joeh')
file = ARGV.last
exit if file.nil?
file = File.expand_path(file)
puts "file: #{file}" if DEBUG
opts = []
File.open($config_file, 'r') do |f|
f.readlines.each do |line|
next if line.start_with?('#')
# at least one tab as separator
path,opt = line.strip.split(/\t+/)
puts "entry: #{path} -> #{opt}" if DEBUG
if file.match(path)
puts "adding: #{opt}" if DEBUG
opts << opt
end
end
end
cmd = "joe #{opts.join(' ')} #{ARGV.join(' ')}"
puts "final: #{cmd}" if DEBUG
# replaces current process
exec(cmd)