diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-10-06 01:07:55 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-10-06 01:07:55 -0700 |
commit | 012fcec93c02c81f20aad7e2abb1d1ededeea60f (patch) | |
tree | 094767c6b6a4268b0b43861fd2fd18d29c940c11 /omptagger | |
parent | 7685de9855d1abd113c846caf163937dabc1951c (diff) | |
download | omptagger-012fcec93c02c81f20aad7e2abb1d1ededeea60f.tar.gz omptagger-012fcec93c02c81f20aad7e2abb1d1ededeea60f.tar.xz |
Add argument parsing; treat each argument as file.
Diffstat (limited to 'omptagger')
-rwxr-xr-x | omptagger | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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 |