diff --git a/lib/flay.rb b/lib/flay.rb index bd7935c..d690ade 100755 --- a/lib/flay.rb +++ b/lib/flay.rb @@ -52,6 +52,7 @@ def self.default_options :liberal => false, :fuzzy => false, :only => nil, + :ext => nil, } end @@ -113,6 +114,11 @@ def self.parse_options args = ARGV options[:timeout] = t.to_i end + opts.on("-x", "--ext EXTENSION", String, + "Use specified file type, regardless of filename.") do |s| + options[:ext] = s + end + extensions = ["rb"] + Flay.load_plugins opts.separator "" @@ -186,8 +192,12 @@ def process(*files) # TODO: rename from process - should act as SexpProcessor files.each do |file| warn "Processing #{file}" if option[:verbose] - ext = File.extname(file).sub(/^\./, "") - ext = "rb" if ext.nil? || ext.empty? + if option[:ext] then + ext = option[:ext] + else + ext = File.extname(file).sub(/^\./, "") + ext = "rb" if ext.nil? || ext.empty? + end msg = "process_#{ext}" unless respond_to? msg then