From 012fcec93c02c81f20aad7e2abb1d1ededeea60f Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 6 Oct 2010 01:07:55 -0700 Subject: Add argument parsing; treat each argument as file. --- omptagger | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'omptagger') diff --git a/omptagger b/omptagger index d603ee8..4b2375a 100755 --- a/omptagger +++ b/omptagger @@ -101,3 +101,25 @@ list if options.include?(:list) help if actions.empty? puts 'No files specified.' if ARGV.empty? + +ARGV.each do |file| + puts file + + # Use absolute path internally. + file = File.expand_path(file) + + begin + raise 'File does not exist.' unless File.exist?(file) + + case File.extname(file).downcase + when '.flac' + puts ' Treat this as a FLAC file.' + when '.ogg' + puts ' Treat this as a Vorbis file.' + else + raise 'File extension not recognised.' + end + rescue RuntimeError => message + puts ' ' + message + end +end -- cgit v1.2.3-70-g09d2