
chuck
By: a guest on Sep 27th, 2009 | syntax:
Ruby | size: 0.61 KB | hits: 69 | expires: Never
#!/usr/bin/env ruby
require 'optparse'
# create an empty hash to hold the options
options = {}
optparse = OptionParser.new do|opts|
opts.banner = "Usage: shift_subtitle [options] file1 file2"
opts.on('-h', '--help', 'Display this screen') do
puts opts
exit
end
opts.on('-o', '--operation STR', 'What type of operation to use') do|o|
options[:operation] = o
end
opts.on('-t', '--time NUM', 'Amount of time to shift') do|t|
options[:time] = t
end
end
optparse.parse!
options[:file1] = ARGV[0] if ARGV[0]
options[:file2] = ARGV[1] if ARGV[1]