bin/flac2mp3 in flac2mp3-0.2.5 vs bin/flac2mp3 in flac2mp3-0.2.6
- old
+ new
@@ -9,14 +9,15 @@
# no rubygems to load, so we fail silently
end
require 'optparse'
require 'flac2mp3'
+require 'flac2mp3/version'
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
-OPTIONS = {}
+OPTIONS = { :delete => false }
MANDATORY_OPTIONS = %w[]
parser = OptionParser.new do |opts|
opts.banner = <<BANNER
Usage: #{File.basename($0)} [filename]
@@ -24,10 +25,13 @@
Options are:
BANNER
opts.separator ''
opts.on('-v', '--version',
"Show the #{File.basename($0)} version number and exit") { puts "flac2mp3 #{Flac2mp3::VERSION::STRING}"; exit }
+ opts.on('-d', '--[no-]delete',
+ "Delete the original file after conversion") { |delete| OPTIONS[:delete] = delete }
+
opts.on('-h', '--help',
'Show this help message.') { puts opts; exit }
opts.parse!(ARGV)
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
@@ -41,6 +45,6 @@
unless filename
puts "Usage: #{File.basename($0)} [filename]"
exit
end
-Flac2mp3.convert(filename.dup)
+Flac2mp3.convert(filename.dup, OPTIONS[:delete])