Skip to content

Instantly share code, notes, and snippets.

@shigeya
Created February 14, 2014 01:33
Show Gist options
  • Save shigeya/8994244 to your computer and use it in GitHub Desktop.
Save shigeya/8994244 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Script to generate sieve script from triplet of folder, header, match
#
#puts 'require "fileinto";'
doif = "elsif"
ARGF.each {|p|
p.chomp!
p.sub!(/^\s+/, "")
p.sub!(/#.*/, "")
if p != "" then
folder, header, match = p.split(/\s+/,3)
match.sub!(/\s+$/, "")
puts "#{doif} header :contains [\"#{header}\"] [\"#{match}\"] {"
puts " fileinto \"#{folder}\";"
puts "}"
doif = "elsif"
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment