summaryrefslogtreecommitdiff
path: root/omptagger
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-10-18 22:05:24 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-10-18 22:05:24 -0700
commit42ad8a7cc806c1dc236530c19612fe947a50d15b (patch)
tree5426eb700f9bb3fca6ff2f9de44bc60214c23077 /omptagger
parent42bbad29bf2d5a7c6e78c53d57c6101b65544ccb (diff)
downloadomptagger-42ad8a7cc806c1dc236530c19612fe947a50d15b.tar.gz
omptagger-42ad8a7cc806c1dc236530c19612fe947a50d15b.tar.xz
Cleaner option parsing.
Diffstat (limited to 'omptagger')
-rwxr-xr-xomptagger13
1 files changed, 6 insertions, 7 deletions
diff --git a/omptagger b/omptagger
index d2f191f..8ff72ce 100755
--- a/omptagger
+++ b/omptagger
@@ -430,8 +430,7 @@ class MP3 < Metadata
end
actions = Array.new
-options = Array.new
-scheme = '%n - %a - %t'
+options = Hash[:scheme => '%n - %a - %t']
GetoptLong.new(
['--view', '-v', GetoptLong::NO_ARGUMENT],
@@ -456,16 +455,16 @@ GetoptLong.new(
when :info
Output.additional_information
when :scheme
- scheme = argument
+ options[option] = argument
when :nocolour, :pretend
- options << option
+ options[option] = true
when :viewtag, :removetag
actions << Action.new(option, argument.dup)
when :addtag, :settag
raise 'Insufficient argument.' unless argument.include?('=')
actions << Action.new(option, *argument.split('=', 2))
when :generate, :rename
- actions << Action.new(option, scheme)
+ actions << Action.new(option, options[:scheme])
else
actions << Action.new(option)
end
@@ -479,7 +478,7 @@ elsif ARGV.empty?
exit
end
-if options.include?(:nocolour)
+if options[:nocolour]
module Output
@colour = false
end
@@ -493,7 +492,7 @@ ARGV.each do |filename|
datum.execute(action)
end
- datum.save unless options.include?(:pretend)
+ datum.save unless options[:pretend]
rescue RuntimeError => message
$stderr.puts $0 + ': ' + filename + ': ' + message
end